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

SN_Learn
Kilo Patron
Kilo Patron

Hi @Nisha30 ,

 

Please try the below:

 

 

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

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

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

 

 

Also, make sure that the notification email script is not bold as shown below, otherwise it will make the whole content in bold. You have the remove the bold then the above script will work fine.

 

SN_Learn_1-1718104756121.png

 

 

Please Mark My Response as Correct/Helpful based on Impact

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

I tried even with <b> and also in my notification that is not BOLD still i am getting all as BOLD

 

Nisha30_0-1718107048412.png

 

 

Nisha30_1-1718107101898.png

 

 

 

Hi @Nisha30 
 
Can you please try below script.
 
 template.print('<div>Here is the Service ' + '<b style="font-weight:600">' + item.service + '</b></div>');
 
 

Hi @jjasonsolomon 

bad luck still its gives all bold 😞 

Thanks