how to print approver name in email notification using dot walking

Rajesh Mushke
Mega Sage
Mega Sage

Hi Team,

how to print approver name in email notification   using dot walking.

My notification is created on RITM(sc_req_item) table, here i want print requested for approver using dot walking.

do we have any other alternative?

Thanks in advance......



Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke
1 ACCEPTED SOLUTION

Use below script inside a mail script.



<mail_script>


var approvers = '';


var app = new GlideRecord('sysapproval_approver');


app.addQuery('sysapproval',current.sys_id);


app.query();



while (app.next())


{


        if (approvers!='')


                  approvers = approvers + ','+app.approvers.getDisplayValue();


        else


                  approvers = app.approvers.getDisplayValue();


}


email.setSubject('You request is pending for approval with '+approvers);


</mail_script>



Check below link. It has everything you want on how to configure your email



https://developer.servicenow.com/app.do#!/lp/servicenow_administrator/app_store_learnv2_automatingap...



Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

SanjivMeher
Kilo Patron
Kilo Patron

You can't use dot walk because requested item to approval table is 1 to many relation.



Query the approval table using script and then print it in the email.



var approvers = '';


var app = new GlideRecord('sysapproval_approver');


app.addQuery('sysapproval',current.sys_id);


app.query();



while (app.next())


{


        if (approvers!='')


                  approvers = approvers + ','+app.approvers.getDisplayValue();


        else


                  approvers = app.approvers.getDisplayValue();


}



Please mark this response as correct or helpful if it assisted you with your question.

Hi Snajiv,



Thank you, can you help me with email script.



and i want print approver name in subject, any idea on this?




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke

Use below script inside a mail script.



<mail_script>


var approvers = '';


var app = new GlideRecord('sysapproval_approver');


app.addQuery('sysapproval',current.sys_id);


app.query();



while (app.next())


{


        if (approvers!='')


                  approvers = approvers + ','+app.approvers.getDisplayValue();


        else


                  approvers = app.approvers.getDisplayValue();


}


email.setSubject('You request is pending for approval with '+approvers);


</mail_script>



Check below link. It has everything you want on how to configure your email



https://developer.servicenow.com/app.do#!/lp/servicenow_administrator/app_store_learnv2_automatingap...



Please mark this response as correct or helpful if it assisted you with your question.