Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Condition to Check for Item's Category on Approval

Sofija
Giga Expert

Hi All,

I have a scheduled job that runs daily to issue approval reminders for outstanding requested item approvals. I now want to split this job to issue one email notification for item's under Hardware category and other for all others.

The issue is that I can't seem to add a correct query to find outstanding approval for requested items where item's category is Hardware.

Queries that I tried and they did not work:

  1. appr.addQuery('sysapproval.ref_sc_req_item.cat_item.category.sys_id', 'e29b2cba0f594200a17bdd44e2050ef6');
  2. appr.addQuery('sysapproval.ref_sc_req_item.cat_item.category', 'e29b2cba0f594200a17bdd44e2050ef6');
  3. appr.addQuery('sysapproval.ref_sc_req_item.cat_item.category', 'Hardware');

Does anyone have any thoughts on what I'm missing here?

Thank you!!

Kamile

12 REPLIES 12

mikeblack
Tera Contributor

declare a variable called cat, it will make it ease



var   cat= sysapproval.cat_item.category.title;



  1. appr.addQuery(cat,"Hardware");

Unfortunately this solution does not work..


sumeet_n
Mega Guru

Hi Kamile, Just modifying your 2nd option as below. This should work. Let me know.



appr.addQuery('sysapproval.cat_item.category', 'e29b2cba0f594200a17bdd44e2050ef6');


Hi Sumeet - sadly this did not work..