record producer hard code an email address to the watchlist

Carol2
Tera Contributor

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;

 
Regards 
C.
1 ACCEPTED SOLUTION

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.

View solution in original post

10 REPLIES 10

Carol2
Tera Contributor

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?

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.

Hi @Carol2 ,

 

Please take a look at the below references:

SN_Learn_0-1721922148352.png

 

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:

SN_Learn_1-1721922276479.png

 

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Carol2
Tera Contributor

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?

Carol2_0-1721989270606.png

Carol2_1-1721989394941.png

 

 

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.