How to add to watchlist from an array

joshehren
Kilo Expert

Hi.   Thanks in advance for your help.  

I have a UI action that creates a RELP from a RITM.   In the UI action, I'd like to get several different usernames from various fields from the RITM and add them to a watchlist on the RELP.

Here's what I have...

var arrayUtil = new ArrayUtil();
var a1 = new Array(current.variables.relp_qa_analyst.getDisplayValue(), current.variables.relp_senior_dev.getDisplayValue(), current.variables.relp_release_engineer.getDisplayValue(),current.variables.relp_pm.getDisplayValue());
relp.watch_list=arrayUtil.unique(a1);

However, I end up with this on the RELP...

find_real_file.png

I don't know how to add the individual values in the array to the watch list.   Help?

Thanks again,

josh

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

The watch list is a comma separated list of sys_ids (to user records). The variables already contain sys_ids so there's no need to use .getDisplayValue() to display a friendly human name.   Try this:



var a1 [];



a1.push(current.variables.relp_qa_analyst);


a1.push(current.variables.relp_senior_dev);


a1.push(current.variables.relp_release_engineer);


a1.push(current.variables.relp_pm);


relp.watch_list=a1.join(',');


View solution in original post

3 REPLIES 3

Mike Patel
Tera Sage

remove .getDisplayValue() and .sys_id to all a1 variables


Chuck Tomasi
Tera Patron

The watch list is a comma separated list of sys_ids (to user records). The variables already contain sys_ids so there's no need to use .getDisplayValue() to display a friendly human name.   Try this:



var a1 [];



a1.push(current.variables.relp_qa_analyst);


a1.push(current.variables.relp_senior_dev);


a1.push(current.variables.relp_release_engineer);


a1.push(current.variables.relp_pm);


relp.watch_list=a1.join(',');


If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you