Mapping the record producer values t a payroll case

pk2184046
Tera Expert

I have two fileds in the record producer

1.HR representative------>reference value

2.Watch list--------->list collector. both of them are variable set values hence mapping cannot be done directly and hence I have to use script.

In the backend where the case gets created whenever the form is raised there we have the watchlist field.

Now both HR rep and watchlist values from the record producer needs to be mapped to watchlist field in the case which is in the backend.

Tried the below script doesn't seems to be working only the watchlist mapping is heppening not the hr rep

var array=[];
var watchlist=producer.watch_list.split(',');
var hr_rep = producer.hr_representative;
var user=hr_rep.concat(watchlist);
current.watch_list=user;
2 ACCEPTED SOLUTIONS

JenniferRah
Mega Sage

Try this:

 

current.watch_list=producer.watch_list.toString() + "," + producer.hr_representative.toString();

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@pk2184046

try this

current.watch_list = producer.watch_list.toString() + ',' + producer.hr_representative.toString();

If my response helped please mark it correct and close the thread so that it benefits future readers.

 

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

View solution in original post

5 REPLIES 5

JenniferRah
Mega Sage

Try this:

 

current.watch_list=producer.watch_list.toString() + "," + producer.hr_representative.toString();

Sandeep Rajput
Tera Patron
Tera Patron

@pk2184046 Please see if this works.

var watchlist=producer.watch_list.split(',');
var hr_rep = producer.hr_representative;
var user=hr_rep.concat(watchlist);
current.watch_list=user.toString();

@pk2184046 Did you check this solution?

Hi  Sandeep Rajput
Thank you for your response I have tried it is getting the values in a single sys id. Below is the screenshot

Screenshot 2025-01-30 125419.png