- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 04:51 AM
Hi,
I have a requirement to hardcode an email address to the watchlist for a record producer. Adding the below code to the record producer script does not work, please assist
var add_mail = " cc@joe.com";
current.watch_list = current.watch_list+','+producer.add_email;
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 03:37 AM - edited 07-26-2024 03:38 AM
Hi @Carol2 ,
The above code which I provided was of Record Producer script which is server side.
In UI policy you have to use client side code that is the reason why it is not working.
Try to set that up in producer script as below:
if(producer.u_caller == 'sysid_of_user1' || producer.u_caller == 'sysid_of_user2' || producer.u_caller == 'sysid_of_user3'){
var add_mail = "cc@joe.com";
var emailArrList = [];
emailArrList.push(add_mail);
current.watch_list = emailArrList.join();
}
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 07:23 AM
no, the mailing list is not a variable in the record producer, only hardcoded to be added to the watchlist.
so, should i create a variable add user's in the mailing list?
then add an if statement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 08:20 AM
You can do both ways.
1. Store the email address of 'requested by' user in a variable and then compare your email with requested for's email and then perform the same action we did earlier to add into watchlist.
2. Directly compare the Requested for's email with the hardcoded email and add in watchlist if match found.
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2024 08:44 AM
Hi @Carol2 ,
Please take a look at the below references:
Here, email address of 'Requested For' is same as of the email then it will add it in watchlist
Script:
var add_mail = "cc@joe.com";
if (producer.email_address == add_mail) {
var emailArrList = [];
emailArrList.push(add_mail);
current.watch_list = emailArrList.join();
}
Result:
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 03:29 AM
created a ui policy and the condition is if its one of the callers then add cc@joe.com to the watchlist. It doesn't work now what am i missing?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-26-2024 03:37 AM - edited 07-26-2024 03:38 AM
Hi @Carol2 ,
The above code which I provided was of Record Producer script which is server side.
In UI policy you have to use client side code that is the reason why it is not working.
Try to set that up in producer script as below:
if(producer.u_caller == 'sysid_of_user1' || producer.u_caller == 'sysid_of_user2' || producer.u_caller == 'sysid_of_user3'){
var add_mail = "cc@joe.com";
var emailArrList = [];
emailArrList.push(add_mail);
current.watch_list = emailArrList.join();
}
Mark this as Helpful / Accept the Solution if this helps.