Update your State Definition in a safe way!
Have you ever face a situation where you update your State Definitions, transitions, or policies but these updates only apply for new records?
Don't worry, this simple utility will help you to apply all your state changes for existing data.
You can even select what data to apply changes by providing custom queries.
Let's started!
Update all devices:
var type = x_nuvo_eam.StateUtils.CLINICAL_TYPE;
// But it can also be:
// var type = x_nuvo_eam.StateUtils.FACILITIES_TYPE;
// var type = x_nuvo_eam.StateUtils.LAB_TYPE;
// var type = x_nuvo_eam.StateUtils.MANUFACTURING_TYPE;
var utils = new x_nuvo_eam.StateUtils(type);
utils.deviceUpdateStateConfig();
Update some devices:
var type = x_nuvo_eam.StateUtils.CLINICAL_TYPE;
// But it can also be:
// var type = x_nuvo_eam.StateUtils.FACILITIES_TYPE;
// var type = x_nuvo_eam.StateUtils.LAB_TYPE;
// var type = x_nuvo_eam.StateUtils.MANUFACTURING_TYPE;
var encodedQuery = "test=123^random=hi";
var utils = new x_nuvo_eam.StateUtils(type);
utils.deviceUpdateStateConfig(encodedQuery);
Update all Work Orders:
var type = x_nuvo_eam.StateUtils.CLINICAL_TYPE;
// But it can also be:
// var type = x_nuvo_eam.StateUtils.FACILITIES_TYPE;
// var type = x_nuvo_eam.StateUtils.LAB_TYPE;
// var type = x_nuvo_eam.StateUtils.MANUFACTURING_TYPE;
var utils = new x_nuvo_eam.StateUtils(type);
var workOrderTypeID = 'ftwretrwe12faftest';
utils.workOrderUpdateStateConfig(workOrderTypeID);
Update some Work Orders:
var type = x_nuvo_eam.StateUtils.CLINICAL_TYPE;
// But it can also be:
// var type = x_nuvo_eam.StateUtils.FACILITIES_TYPE;
// var type = x_nuvo_eam.StateUtils.LAB_TYPE;
// var type = x_nuvo_eam.StateUtils.MANUFACTURING_TYPE;
var encodedQuery = "test=123^random=hi";
var utils = new x_nuvo_eam.StateUtils(type);
var workOrderTypeID = 'ftwretrwe12faftest';
utils.workOrderUpdateStateConfig(workOrderTypeID, encodedQuery);
👤 Luis Morón
- Website: luifermoron.com
- Github: @luifermoron
- LinkedIn: @luifermoron
Give a ⭐️ if this project helped you!