Trigger notification from workflow

avinashdubey103
Tera Guru

Hi , I am facing an  issue , the requirement is that notification should be triggered to service owner of MIS , IS , BTG, OCIO whose install status is live .
But the notifcation is sending to only MIS serviceowner not all 

notification:

avinashdubey103_0-1701942490458.png


// Set the variable 'answer' to a comma-separated list of user or group sys_ids that you want the email sent to.
answer = [];
var gr = new GlideAggregate("cmdb_ci_service");
gr.addEncodedQuery('u_business_unitINBTG,IS,MIS,OCIO,Support^install_status=300');
//gr.addAggregate("COUNT");
gr.groupBy("owned_by");
gr.query();
while (gr.next()) {
answer.push(gr.owned_by.toString());
gs.log("Ayurveda"+answer);
}

5 REPLIES 5

Anand Kumar P
Giga Patron
Giga Patron

Hi @avinashdubey103 ,
Use  gs.log("Ayurveda"+ answer.join(', '));  and also where you are returning  array   return answer.join(', ')) in script or calling event(gs.eventQueue('eventname',current,answer.join(', ')); in script to trigger notification.

Please mark it as helpful and solution proposed if it serves your purpose.

Thanks,

Annad

need to update in this pushstatement also

answer.push(gr.owned_by.toString());     ???

Yes

Use  answer.push(gr.owned_by.toString());  and also where you are returning  array   return answer.join(', ')) in script or calling event(gs.eventQueue('eventname',current,answer.join(', ')); in script to trigger notification

Shamma Negi
Kilo Sage
Kilo Sage

Try this please:

 

var answer = [];
var gr = new GlideAggregate("cmdb_ci_service");
gr.addEncodedQuery('u_business_unitINBTG,IS,MIS,OCIO,Support^install_status=300');
//gr.addAggregate("COUNT");
gr.groupBy("owned_by");
gr.query();
while (gr.next()) {
answer.push(gr.owned_by.toString());
}

gs.log("Ayurveda"+answer);

 

Result :

 

*** Script: ,06826bf03710200044e0bfc8bcbe5d93,77ad8176731313005754660c4cf6a7de,5137153cc611227c000bbd1bd8cd2005,5f728212c0a8010e004a13c7588047dd,5b7c200d0a640069006b3845b5d0fa7c,46d59205a9fe198101d603f5de37bfa3,5f675796c0a8010e0132f67844388c58,06826bf03710200044e0bfc8bcbe5d81,46c5bf6ca9fe1981010713e3ac7d3384,16826bf03710200044e0bfc8bcbe5da1

Regards,Shamma Negi