- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 08:13 PM
Hi,
I have created a new catalog item where one of the variable items is mandatory (Select CI - referencing from cmdb_ci) whenever a user is raising the catalog.
When the catalog is submitted, I would require the field "Affected CI" in the RITM to be updated as per the value selected when submitted, i.e Select CI and subsequently the same value also to be updated in the same field value "Affected CI" available in the catalog task.
I have created two Business rules indicating the above requirements but after testing the value for the Affected CI field (in both RITM and Catalog Task) are still showing up as empty. Not too sure if anything wrong in the business rules script.
This is my Business Rules for both update of Affected CI in RITM and Catalog Task:
RITM Insert
Catalog Task:
These are the value i need updated to my RITM and Catalog Task "Affected CI" fields respectively.
Appreciate your kind inputs. Thank you
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 08:22 PM
Hi @Susan Goh
Are these scripts written in business rules? Usually if it is an insert business rule, the function block should look as below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 08:44 PM
are you using flow for your catalog item?
Then it's very easy
1) use "Get Catalog Variables" Flow action
2) then use "Update Record" flow action and update the field by selecting the correct variable from data pill
3) Then while creating catalog task use Set Field Values and set the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 10:39 PM
Hello @Susan Goh ,
Do you require this logic for all existing Catalog Items? If not then a Business Rule is not the appropriate solution.
Instead, populate the Configuration Item field using the Workflow or Flow that is associated with this particular Catalog Item.
If using a Workflow you just need to add a "Run Script" activity at the beginning, with the following line:
current.configuration_item = current.variables.select_CI;
And for the task you would add this script to the "Catalog Task" activity:
task.cmdb_ci = current.configuration_item;
If you are using a Flow then use the steps mentioned by @Ankur Bawiskar .
Please also make sure you are looking at the correct field, since a RITM has two CMDB reference fields (configuration_item, cmdb_ci), and it's the former that is shown on the RITM form by default, while your BR is populating the latter. I used configuration_item in the above scripts.
If you really need Business Rules then update the function surrounding your script to this:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
})(current, previous);
The functions in your current scripts has an invalid signature, especially the latter which rather looks like something used in a Flow Designer Script step.
Please also make sure it's a "before insert" Business Rule, and do not use "current.update()".
Regards,
Robert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 08:22 PM
Hi @Susan Goh
Are these scripts written in business rules? Usually if it is an insert business rule, the function block should look as below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 10:30 PM
Ahh... no wonder, how silly of me. overlooked that portion. Have managed to get it sorted and its reflecting correctly now. Thanks alot for the insight and enlightenment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 08:44 PM
are you using flow for your catalog item?
Then it's very easy
1) use "Get Catalog Variables" Flow action
2) then use "Update Record" flow action and update the field by selecting the correct variable from data pill
3) Then while creating catalog task use Set Field Values and set the value
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2025 10:36 PM
Thanks Ankur for the suggestion. Unfortunately was advised against doing any kind of amendment on the existing flow design for our orgs catalog using flow designer or action in anyway. Hence, opted for the Business Rules script option. But will definitely keep this suggestion in mind for future. I learnt something new as well. Thank you so much. My current issue has been sorted.