How to get variable value in email script

MK-p
Tera Contributor

I am trying to get the variable value in client script, but it is not working.

i tried with below code

var x = current.variables.manager.email;

1 ACCEPTED SOLUTION

Hi @MK-p 

 

Try below code.

var gr = new GlideRecord('sc_req_item');  
gr.addQuery('request_item', current.sys_id); 
gr.query(); 
if(gr.next()) { 
  x = gr.variables.manager.email;
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

View solution in original post

Part 2. In this video i have talked about overview on ServiceNow platform/tool. How you can opt for personal dev instance (PDI)? how to login in ServiceNow instance and navigation to OOB modules. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on
5 REPLIES 5

Runjay Patel
Giga Sage

Hi @MK-p ,

 

You can try with below code.

var gr = new GlideRecord('sc_req_item');  
gr.addQuery('sys_id', current.sys_id); 
gr.query(); 
if(gr.next()) { 
  x = gr.variables.manager.email;
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Part 2. In this video i have talked about overview on ServiceNow platform/tool. How you can opt for personal dev instance (PDI)? how to login in ServiceNow instance and navigation to OOB modules. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on

Hi @Runjay Patel ,

 

Notification is event based and configured on item table but i am triggering it from sc task.

Hi @MK-p 

 

Try below code.

var gr = new GlideRecord('sc_req_item');  
gr.addQuery('request_item', current.sys_id); 
gr.query(); 
if(gr.next()) { 
  x = gr.variables.manager.email;
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Part 2. In this video i have talked about overview on ServiceNow platform/tool. How you can opt for personal dev instance (PDI)? how to login in ServiceNow instance and navigation to OOB modules. For document please visit: https://servicenowwithrunjay.com/ Follow Facebook page for latest update on

Thanks @Runjay Patel , worked perfectly.