We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

I have to set notification subject.

niveditakumari
Giga Sage

Hi, 

 

I have to set notification subject. I have created notification on approval table and have to set notification subject and I have created email script and in that I'm setting order guide field value. I have to set order guide field value in notification subject. 

Please find attached screenshot : 

Notification : 

niveditakumari_0-1770727117548.png 

 

Email Script : 

niveditakumari_1-1770727167837.png

 

Can you please help me to set subject. 

 

Regards, 

Nivedita 

 

 

 

 

 

11 REPLIES 11

Hi @Ankur Bawiskar

 

I'm having subject 

Approval request for ${sysapproval.cat_item.name} Questionnaire - 

and have to set subject after Questionnaire - Order guide field value. 

Can I set Order guide field value from email script using email.setSubject. 

When I use email script will it override subject Approval request for ${sysapproval.cat_item.name} Questionnaire - to Order guide field value. 

Can you please confirm for that. 

 

Regards, 

Nivedita 

 

 

 

 

@niveditakumari 

yes that's what I mentioned, don't give anything in Subject as you will set it using email script

AnkurBawiskar_0-1770732587559.png

 

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar

 

Can we use email script and add all Subject all together and have to set Approval request for ${sysapproval.cat_item.name} Questionnaire - Order guide field value

Can you please help me with that. 

 

Regards, 

Nivedita 

 

 

Hi @Ankur Bawiskar

 

I have to add notification subject as 

  • Approval request for <catalog_item_name> Questionnaire - <Name of Project/Initiative_Variable

Can you please help me how to achieve that. 

 

Regards, 

Nivedita 

 

 

@niveditakumari 

something like this

I hope you are aware how to call email script from email body

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

    // Add your code here
    var ritm = new GlideRecord('sc_req_item');
    if (ritm.get(current.sysapproval)) {
        var subject = 'Approval request for ' + ritm.cat_item.name + ' Questionnaire - ' + ritm.variables.initiative_name.getDisplayValue();
        email.setSubject(subject);
    }

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

💡 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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader