Custom RITM approval notification dependent on specific variable on catalog item

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2019 09:38 AM
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":
Is there a way to add an "AND" condition under the "Approval for.Task type is Requested Item" for the other conditions I need?
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2019 09:12 AM
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?
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 06:21 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-26-2019 07:54 AM
Ankur, can you advise on how to enable logging for this specific event?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-27-2019 09:24 PM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2019 08:03 AM
Ankur, the log displays the correct name of the item as expected, but the "yes no" value is reporting the following:
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':
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.