Trigger notification from workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 01:49 AM
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:
// 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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:38 AM - edited 12-07-2023 02:54 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 02:43 AM
need to update in this pushstatement also
answer.push(gr.owned_by.toString()); ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 03:04 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 03:19 AM
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