Writing a business rule for a catalog Item. Scripting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2022 11:37 PM
I have a catalog Item VM Provisioning, for which my requirement is
Stage1: if RITM Stage is 'Request Approved' then I need to append the 'description of RITM' with +' The RITM needs further action '.
Stage1: if RITM Stage is 'Request Completed' then I need to append the 'description of RITM' with +' The RITM needs no further action '
For this I am creating a business rule and writing a script, below are screenshots. Please help me out with corrections.
The below code is working fine for a single record not able to do it for all records.
var newdescription;
var gr = new GlideRecord('sc_req_item');
gr.addQuery('number','RITM3859718');
gr.query();
if (gr.next()){
if (gr.stage == 'request_approved'){
newdescription = gr.description +' '+'The RITM needs further action';
gr.setValue('description',newdescription);
gr.update();
}
else if(gr.stage == 'request_completed');{
newdescription = gr.description +' '+'The RITM needs no further action ';
gr.setValue('description',newdescription);
gr.update();
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 12:19 AM
Hi,
You should not do this in a business rule.
Instead, set the description of the RITM in Flow actions or in Workflow run scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 05:05 AM
@OlaN why do you think we should not do this via BR?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 07:25 AM
To avoid having multiple sources changing the data in the RITM record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2022 04:38 AM
Code is working fine for a single record and not able to do it for all records because you are running it for 'RITM3859718' only
Add your code in runscript in your catalog workflow
gr.addQuery('number','RITM3859718'); // remove this line from your code