How to call variable in email scripts from sysapproval table in email notification of servicenow

Arun91
Tera Contributor

Hi,

I have a requirement that I need to call a variable from email scripts in servicenow from sysapproval table. Kindly help me on that.

4 REPLIES 4

Community Alums
Not applicable

Hi,

I have tried the code but it is not working. I am using Order guide for creating service request. Once request is submitted, approval will be triggered. The approval is in Service Request. The approval email goes to the approver that should display all the ritm variables in the email

Sumanth16
Kilo Patron

Hi @Arun91 ,

 

https://www.servicenow.com/community/itsm-forum/display-the-requested-item-variables-in-approval-not...

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

 

Himani_14
Mega Sage
Mega Sage

Hi @Arun91 ,

 

Please try to use below script :

 

 
var infoVar = new GlideRecord('sc_item_option_mtom');
    infoVar.addQuery('request_item', current.sysapproval);
    infoVar.orderBy('sc_item_option.order');
    infoVar.query();
    while (infoVar.next()) {

        var question = infoVar.sc_item_option.item_option_new.getDisplayValue();
        var value = infoVar.sc_item_option.value;
        //gs.print(question + '  ' + value);

    }
 
Thank you