Wait for CHG to be in Scheduled State and then update RITM variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 11:23 AM
I have a workflow for a catalog item that we would like to hold until a CHG has reached the Scheduled State. The form asks for the CHG number in a reference field (currently no conditions). I have a checkbox on the Catalog Item (which will be hidden) that is called CHG Approved. I have a Wait for Condition that waits for the box to be checked before continuing the workflow. There is a Business Rule that is supposed to check the box but the BR isn't working.
BR
Table: change_request
When to Run: Before Update
Conditions: State changes to Scheduled
OR State is one of Scheduled, Implement, Review, Closed
Advanced Actions:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 05:41 PM
Hi @erin-marie,
I am assuming that the CHG reference field is a variable of the catalog item.
If so, can you try the following:
(function executeRule(current, previous /*null when async*/ ) {
var aws = new GlideRecord('sc_req_item');
aws.addEncodedQuery('variables.{sys_id of variable}=' + current.getUniqueValue()); //use your reference variable's sys_id. Also you may want to add additional condition such as item={sys_id of catalog item}
aws.query();
while (aws.next()) {
aws.variables.sc_aws_assetdecom_chg_approved = true;
aws.update();
}
})(current, previous);
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 06:40 PM
I think that did the trick!! Going to do a little more testing and then I will accept solution. Thank you so much!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2024 07:24 PM
No worries, I forgot to mention in the last reply, but I would recommend changing it to run after instead of before. You would only want this to be executed after the condition is satisfied.
Cheers