Custom RITM approval notification dependent on specific variable on catalog item

Chase Stevenson
Mega Guru

Hello, we use a single approval notification for all Requested Item approvals in our instance.

What I want to do is have a second approval notification that ONLY gets used when 1 of our 40+ catalog items gets submitted and a specific variable on that catalog item has a specific value.

When looking at the notification "When to send" section, I can't think of a way to identify a condition where catalog item has to = "xyz" and variable x has to = "123":

find_real_file.png

Is there a way to add an "AND" condition under the "Approval for.Task type is Requested Item" for the other conditions I need?

16 REPLIES 16

Good morning, thanks for the suggestion - I tried the provided script and cannot get the notification to be triggered.

I submit the request and when approval is triggered in the workflow, it isn't sending this custom notification.

Does the configuration look correct?

find_real_file.png

The variable I'm looking for is a Yes/No variable rather than a checkbox (that's why I put == 'yes'). Also, the catalog item name, would I need to insert sysID or something else than just the text name of the item?

Hi Chase,

Can you try the condition I had written earlier.

answer = (current.sysapproval.ref_sc_req_item.cat_item.name == 'ITEMNAME' && current.variables.override_yesno == 'true');

 

In case if it doesn't work, can you please add logs and see if it returns the expected values.

 

Let me know it it helps.

Ankur, can you advise on how to enable logging for this specific event?

Hi Chase,

Add gs.log() statement in the Advanced condition of the email. So something like below.

gs.log("Item Name: " + current.sysapproval.ref_sc_req_item.cat_item.name);

gs.log("Yes No value: " + current.variables.override_yesno);

answer = (current.sysapproval.ref_sc_req_item.cat_item.name == 'ITEMNAME' && current.variables.override_yesno == 'true');

 

Let me know if it helps.

Ankur, the log displays the correct name of the item as expected, but the "yes no" value is reporting the following:

find_real_file.png

I tried using "current.sysapproval.ref_sc_req_item.variables.ciociso_override_yesno" on a whim, and that seems to work for getting the correct value of the "yes no" as 'Yes':

find_real_file.png

I updated the script to look for value of 'Yes' and it now triggers the notification.

Thank you for your assistance in getting this to work.