The CreatorCon Call for Content is officially open! Get started here.

Catalog item name in subject line of email notification

Bargavi
Mega Expert

Can we display the "catalog item name" in the subject line of approval email notification.

Ex: The subject line sent to an approver should be " Requested Item RITMXXXXXXX Approval Request for Catalog_item_name". Can someone help me.

Thanks,

Bargavi

1 ACCEPTED SOLUTION

madanm7786
Mega Guru

Hi Bargavi,



Try ${document_id.cat_item}



Thanks,


Maddy


View solution in original post

9 REPLIES 9

Prasun
Giga Guru

Hello,



Go to the email template that is written for the approval email --> The Subject Line should be (in the template) Requested Item ${sysapproval} Approval Request for ${sysapproval.item.name}



Anything ${sysapproval} actually refers to the sys_id of the record of the task for which the approval is going to. So you can achieve many things with dot walking like I did. Hope this helps


Hi Prasun,



Thanks for replying. Unfortunately, the solution did not work. The notification being triggered is Approval Request and the template used is change.itil.approve.role, I updated the subject of change.itil.approve.role but it is not working.



It still shows like below.


find_real_file.png



Thanks,


Bargavi


Try this.



Requested Item ${sysapproval} Approval Request for ${sysapproval.cat_item.name}



Item is the display value, cat_item is the name of the field. I think it should work.


Hi Prasun,



I have issues with request.general e-mail template.


1. It doesnot add the catalog name to the subject line with ${sysapproval.cat_item.name} and


2. I have change.itil.approve.role template with a mailscript to include all the variables in the catalog item. the same mail script does not work with request.general template. Do I have to modify anything in below script so that it works even for request.general



var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);
template.print("Summary of Requested item:\n");
var scReqItem = new GlideRecord("sc_req_item");
scReqItem.addQuery("sys_id", current.sysapproval.toString());
scReqItem.query();
while (scReqItem.next()) {
gs.print(scReqItem.number + ": " + scReqItem.quantity + " X" + scReqItem.cat_item.getDisplayValue() + "\n");
gs.print(" Options:\n");
var varown = new GlideRecord('sc_item_option_mtom');
varown.addQuery("request_item", current.sysapproval.toString());
varown.orderBy("sc_item_option.order");
varown.query();
while (varown.next()) {
var visible = varown.sc_item_option.item_option_new.visible_summary;
//var question = Packages.com.glideapp.questionset.Question.getQuestion(varown.sc_item_option.item_option_new);//Packages
call replaced with line below on CAlgary+
var question = GlideappAbstractChoiceListQuestion.getQuestion(varown.sc_item_option.item_option_new);
question.setValue(varown.sc_item_option.value);
if (question.getLabel() != "" && question.getDisplayValue()!= "" && visible == true) {
template.space(4);
template.print(' ' + question.getLabel() + " = " +
question.getDisplayValue() + "\n");
}}}




Thanks,


Bargavi.