Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Update RITM watch list from catalog item variable

rconstantino
Mega Sage

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

1 ACCEPTED SOLUTION

@rconstantino 

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! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

16 REPLIES 16

@Ankur Bawiskar  - Thank you for always being so helpful.  I applied the combined BR to the one catalog item, left the other BR active and tested with multiple requests - the correct people are added to the watch list now.  

What do you want to see for screen shots?