Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Populate the 'to' field in Email Client template

russellprice
Tera Contributor

Hi

I have setup a Client template for incidents which uses a script to populate the email client (envelope Icon) with details of the incident. I would also like to automatically populate the the 'to' field with the owner of the selected CI in the incident record. The problem is, no matter what I do I cant seem to script anything that populates the 'to' field?

I suspect the 'to' field in the email client cant be populated with scripts? and the email address must be entered directly?

Can anyone suggest a way round this? I really need the email client 'to' field to be dynamic.

Thanks

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You can do this with an email client Template from System Policy> Email> Client Templates.

 

You can dot-walk to your email field through any field on the form. Example from Customer Service:

 

find_real_file.png

 

Docs: Create an email client template

View solution in original post

17 REPLIES 17

Ian Mildon
Tera Guru

Try entering cmdb_ci.owned_by.email into the To field.

ravichanduk
Mega Expert

goto email client template create new 

on to field write the script javascript:gs.getUserid()

This does not work for me, however this does javascript:gs.getUser().email

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


You can try cmdb_ci.owned_by if not then use below approach,

You can use javascript: script include.function name(current.cmdb_ci);

Then from your script include you can return the value of owned by person or his email id.


Thanks,
Ashutosh munot