- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Looking for help on how to update the the RITM watch list from values from 2 variables on that Catalog Item.
How best to accomplish this?
Thank you.
Rachel
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
then combine both the scripts in your 1 business rule and delete the other one
updated script for both
(function executeRule(current, previous) {
    var list = [];
	
    if (current.variables.primary_program_poc)
        list.push(current.variables.primary_program_poc.toString());
    if (current.variables.secondary_program_poc)
        list.push(current.variables.secondary_program_poc.toString());
    if (current.variables.requested_for)
        list.push(current.variables.requested_for.toString());
    if (list.length > 0) {
        current.watch_list = list.join(',');
        current.setWorkflow(false);
        current.update();
    }
})(current, previous);💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Both the variables are reference type, pointing to the sys user table
What should the script look like?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
then after insert BR will work
Condition: current.cat_item.name == 'Your Item Name Here'
(function executeRule(current, previous) {
    var list = [];
    if (current.variables.primary_program_poc)
        list.push(current.variables.primary_program_poc.toString());
    if (current.variables.secondary_program_poc)
        list.push(current.variables.secondary_program_poc.toString());
    if (list.length > 0) {
        current.watch_list = list.join(',');
        current.setWorkflow(false);
        current.update();
    }
})(current, previous);💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago - last edited 2 weeks ago
THANK YOU this worked however it removed the 'requested for' - can we include that?
I do have a business rule in place for the requested for:
I need this business rule to continue to execute along with the business rule for the one catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
then combine both the scripts in your 1 business rule and delete the other one
updated script for both
(function executeRule(current, previous) {
    var list = [];
	
    if (current.variables.primary_program_poc)
        list.push(current.variables.primary_program_poc.toString());
    if (current.variables.secondary_program_poc)
        list.push(current.variables.secondary_program_poc.toString());
    if (current.variables.requested_for)
        list.push(current.variables.requested_for.toString());
    if (list.length > 0) {
        current.watch_list = list.join(',');
        current.setWorkflow(false);
        current.update();
    }
})(current, previous);💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
