How to setup Conditions on the sysapproval_approver email notification for certain Request Items

Peter Williams
Kilo Sage

Hello everyone,

 

i need some advise. 

i have created a few catalog items using the sc_req_items that has approvals added to them.

I was able to make a email script to read the request items variables and have them displayed on the approval email

======================================
${mail_script:exp_full_approval_v2} (this is the custom script for the ritm variables )
 

${mail_script:email.button.approve.insert }     ${mail_script:email.button.reject.insert } 

Approval Activity:
${mail_script:approval_activity}

Click here to view ${sysapproval.sys_class_name}: ${sysapproval.URI}

${mail_script:attachments}
 
====================
 
What i need is to add in conditions into the notification so that it will only send out this notification base on the catalog item that was being filled out, in this case an expense report.
 
i tried using this: (questions is a dot walk from Approver for.Questions
PeterWilliams_0-1697823733255.png

 

however, wheneven i update or save this, the conditions returns to blank.
PeterWilliams_1-1697823806961.png

 

 

what can i do to have this to work?

 
9 REPLIES 9

Alka_Chaudhary
Mega Sage
Mega Sage

Hello @Peter Williams ,

You can try advanced condition. You can refer to this documentation:- LINK.

Please Mark my answers Helpful & Accepted if I have answered your questions.

Thanks,

Alka

yes i was thinking of this but not sure how to configure it for a sc_req_item 

 

Hello @Peter Williams ,

You can use below script in the advanced condition and change the catalog item query and answer value as per your requirement.

var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('source_table', 'sc_req_item');
gr.query();
if (gr.next()) {
    var req = new GlideRecord('sc_req_item');
    req.addQuery('sysapproval', current.sysapproval);
    req.addquery('cat_item.name', 'name of the catalog item');
    req.query();
    if (req.next()) {
        answer = true;
    } else {
        answer = false;
    }
}

Please Mark my answers Helpful & Accepted if I have answered your questions.

Thanks,

Alka

 

i am sorry to say but it didnt work

 

PeterWilliams_0-1697827389540.png