Notification advanced condition.

Community Alums
Not applicable

Hi All,

 

I want to send a notification when the attached workflow of item in a request is "XXXXXX".Please refer the below screen shot and help me in finding out what went wrong.

The current script is not triggering notification at all.

When to send

Add AND conditionAdd OR ConditionDelete

 

 

var reqItems = new GlideRecord("sc_req_item");

reqItems.addQuery("request",current.request);

reqItems.query();

while(reqItems.next()){

var i=reqItems.cat_item;

var array = i.split(",");

for (var j=0; j < array.length; j++){

var object=array[j];

var item=new GlideRecord('sc_cat_item');

item.addQuery('sys_id',object);

item.query();

while(item.next()) {

if(item.workflow.name=='SRM Common Workflow'){

answer=true;

}

else {

answer=false;

}

}

}

}

 

 

 

Regards,

Kirti.

4 REPLIES 4

User140988
Kilo Guru

Hi Kirti,



Can you not directly trigger the notification on the workflow of the specific catalog item (on SRM common workflow) instead of running the script on sc_request table trying to identify if any of the catalogue items trigger the SRM common workflow and then trigger the event.



Regards,


Chandana


Community Alums
Not applicable

Hi Chandana,



The problem is i have a restriction here.Notification is based on request. for every request i have to query for the number of items with category 'A'   and send a notification.I have even tried the same from workflow in request table.but no luck



Regards,


Kirti.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Kirti Nair



The best way is to fire the event from the "item level" as and when the condition is satisfied.


Please refer the below wiki link for further info


http://wiki.servicenow.com/index.php?title=Events_and_Email_Notification



Thanks,


Pradeep Sharma


Community Alums
Not applicable

Hi Pradeep,



trying this way too




Regards,


kirti