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.

How to make bold only selected words in email script template.print

Nisha30
Kilo Sage

Hello Experts,

I am trying to make text bold it is working but what I am looking for is I want only service to be bold but instead it is giving me whole print as bold. Any suggestions how do i rectify it

In email script using this

 

template.print("Here is the Service"+<strong>+"\""+item.service+"\""+</strong>);

 

Result : I am getting the whole sentense as bold starting from "Here is the Service............"

Just want to make item.service result as BOLD.

 

Thanks

 

 

1 ACCEPTED SOLUTION

Hi @Nisha30 ,

 

I have tried the below in PDI and it is working as expected:

Notification Email Script:

Name: testNotifScript

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

    template.print("Here is the Service" + "\""+'<b>' + current.caller_id.getDisplayValue() + '</b>');

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

 

Email Notification:

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

 

SN_Learn_1-1718124667077.png

 

 Notification Output:

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

 

SN_Learn_0-1718124639618.png

Could you please share the whole notification script and the output please?

 

Please Mark My Response as Correct/Helpful based on Impact

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

View solution in original post

6 REPLIES 6

Hi @Nisha30 ,

 

I have tried the below in PDI and it is working as expected:

Notification Email Script:

Name: testNotifScript

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

    template.print("Here is the Service" + "\""+'<b>' + current.caller_id.getDisplayValue() + '</b>');

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

 

Email Notification:

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

 

SN_Learn_1-1718124667077.png

 

 Notification Output:

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

 

SN_Learn_0-1718124639618.png

Could you please share the whole notification script and the output please?

 

Please Mark My Response as Correct/Helpful based on Impact

----------------------------------------------------------------
Mark this as Helpful / Accept the Solution if this helps.

Thankyou all for instant assistance.

What I did was created a completely new notification and email script with above code. It is working now not sure for the existing one what was wrong