email script for signature [Please see description]

snow34
Tera Contributor

I want to give signature at the footer as pe assignment group f

For example: If assignment group is abc then signature of abc assignment group should be there 

1 ACCEPTED SOLUTION

You need to create signatures in notification email scripts for each assignment group. you can take below reference.

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


    var group1_name = "Grpup1_name";
    var group1_sys_id = "group1_sys_id";
    var group1_description = "Group1 description";

    var group2_name = group2_name;
    var group2_sys_id = "group2_sys_id";
    var group2_description = "Group2 description";



    if (group1_sys_id == current.assignment_group) { // add Group1 - email signature

        template.print("Thanks and Regards," + "<br />" +
            group1_name + "<br />" +
            group1_description + "<br />");
		
    } else if (group2_sys_id == current.assignment_group) { // add Group1 - email signature

        template.print("Best Regards," + "<br />" +
            group2_name + "<br />" +
            group2_description + "<br />");
    }



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

 

Thanks!

Sagar Pagar

The world works with ServiceNow

View solution in original post

12 REPLIES 12

Hemant1
Kilo Expert

Hello 

Try this Below Approach 

1.Write the display Business rules and store the assignment group in Scratchpad 

2.Write the Onload Client Script fetch assignment and store the signature in the variable

Please mark my answer as Helpful and Correct

Reg

Hemant Kumar Ch

Aman Kumar S
Kilo Patron

You need to write an email script, in which you need to fetch the information of assignment group of the task.

Include that email script in your notification, so dynamically whatever your task's assignment group is, the signature would pass on to the notification.

You should find relevant articles in the portal about email script and how to embed it in notification.

 

Feel free to drop thumbs up, if this helps your case šŸ™‚

Best Regards
Aman Kumar

Sagar Pagar
Tera Patron

To auto populate the email signature based on assignment group, you need to create email script and call in in email client template.

 

Email script:

Name: get_signature

New line to HTML: true

Script:

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

	var logged_user = new GlideRecord('sys_user');
	logged_user.get(gs.getUserID());

	template.print(logged_user.getValue("name")+'\n');
	template.print(current.assignment_group.getDisplayValue()+'\n');

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

 

Email client Template:

Name: EmailClientName

Table: your table name

Subject: subject line

Body HTML: add body contents & Call email script in email client template as,

${mail_script:get_signature}

 

Thanks!

Sagar Pagar

The world works with ServiceNow

but how this will print signature