Get asset variable value in a ui action on the asset table

Moedeb
Tera Guru

I want to be able to trigger an event that will sent a notification - this I can do, however getting the parm1 value correct so it sends to the correct person, not so much.

 

So on the alm_asset table I have a field that I added called u_responsible_officer (reference field on the sys_user table)

 

What I want to do is the have a UI action - form link (on an alm_asset record) that triggers an event that send the notification to the name/email address of the person in the u_responsible_officer field.

 

I have the script I need to trigger the event successfully, I'm just not sure how to add the email address to the script to dynamically get it from the u_responsible_officer field.

gs.eventQueue("update.due", current, "u_resonsible_officer.email");
action.setRedirectURL(current);
gs.addInfoMessage("Email has been triggered");

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Moedeb 

your syntax is wrong

Ensure Event parm1 contains recipient checkbox is True in your notification

I hope event, notification are on alm_asset table

gs.eventQueue("update.due", current, current.u_resonsible_officer.toString());
action.setRedirectURL(current);
gs.addInfoMessage("Email has been triggered");

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

6 REPLIES 6

@Ankur Bawiskar 

I'm sorry, some how I was testing on an asset where the u_responsible_officer was not populated, which is why the parm1 was blank.

 

Thank you very much for your help

@Moedeb 

is it a field or a variable and record is generated via record producer?

if it's a variable in variable editor then use this syntax

gs.eventQueue("update.due", current, current.variables.u_responsible_officer.toString());
action.setRedirectURL(current);
gs.addInfoMessage("Email has been triggered");

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