How to update CMDB_CI state with business rule on change state to implement

Darren32
Giga Contributor

Hi

I've created a business rule on the change_request table which is triggered when change state goes to implement and the action is supposed to update the affected configuration item state to "in maintenance".

I can see in the business rule debug that this is being triggered however, it isn't changing the state of the CI. Is the business rule configured correctly?

 

find_real_file.png

find_real_file.png

 

 

find_real_file.png

1 ACCEPTED SOLUTION

Thanks

 

I wrote the below script which works.

 

(function executeRule(current, previous /*null when async*/) {

// Add your code here





var CMDBci = new GlideRecord('cmdb_ci'); //glide record to ci
CMDBci.get('sys_id', current.cmdb_ci); //grab the sys_id matched from current ci
CMDBci.setDisplayValue('install_status','3'); //update to in maintenance
CMDBci.update();

})(current, previous);

View solution in original post

5 REPLIES 5

Alikutty A
Tera Sage

Hi,

Can you make this to an After BR and see if it works for you?

Thanks

Michael Fry1
Kilo Patron

Since the update is occurring on the Change Request table, you'll have to use a GlideRecord to query the CI and update the State.

Thanks

 

I wrote the below script which works.

 

(function executeRule(current, previous /*null when async*/) {

// Add your code here





var CMDBci = new GlideRecord('cmdb_ci'); //glide record to ci
CMDBci.get('sys_id', current.cmdb_ci); //grab the sys_id matched from current ci
CMDBci.setDisplayValue('install_status','3'); //update to in maintenance
CMDBci.update();

})(current, previous);

RiteshSwarnakar
Giga Guru

The below Business Rule Script is working fine for the Scenario: To change the status of all Affected CIs to Retired when Change Request state changes to Closed

You can change the script according to your requirement.

 

When to run : set When as async and Filter Conditions as State changes to Closed

 

 find_real_file.png

 

 

Thanks,

Ritesh