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.

Survey Notification

Juhi Chawla2
Tera Contributor

Hi Experts, 

 

I have a requirement where I have created the notification on the core case table and same notification is sent for all COEs. Now I want to insert a line in notification body to tell if this is a payroll case or benefits case or any other COE . I want to achieve this through an email script . Can any one of you suggest how we can do this . 

 

Thanks in advance !

8 REPLIES 8

Hi @Sarthak Kashyap , 

 

Looks Awesome, but can we get the COE name like PAYROLL , BENEFIT, TALENT MANAGEMENT and not backend name of COE  also HR service name is not required. Basically I am not able to understand how I can add the template.print line code for all diffent COEs.Is there a way to connect with you ?Also can you refer below screenshot  and suggest accordingly . 

 

In this notification , in place of HR case , it should display the COE name LIKE PAYROLL , BENEFITS, COMPENSATION , like that . 

 

Thanks a lot for help in advance

Ankur Bawiskar
Tera Patron
Tera Patron

@Juhi Chawla2 

you simply check the table name or class name like this and print the table name/HR Service

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    template.print('HR COE is: ' + current.hr_service.topic_detail.topic_category.coe);

})(current, template, email, email_action, event);

In your notification call this email script

${mail_script:my_coe_table}

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@Ankur Bawiskar 

 

how it should be if in the Below screenshot in Place of HR case we need to get the name Of COE dynamically . Say if it is a payroll case , it should mention Payroll in place of HR in the below case and like that for all the COE like benefits , benefits case. Please suggest with the code. 

@Juhi Chawla2 

that's what I mentioned.

Did you try that email script?

That will give you table name and then you can query sys_db_object with that table and get table label.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader