how to send notification by clicking UI action button
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2021 11:14 PM
Iam having a button called send notification when iam clicking that button notification has to be send to the user ??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-19-2021 02:53 AM
Please follow the below links and you should be able to achieve this.
It would be learning exercise for you as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2021 11:49 PM
1. Create an event in Event Registry table
2. Create a notification with Trigger Type when "Event is fired"
3. Trigger event from the UI Action using gs.eventQueue(eventname,gliderecordobject,parm1,parm2) method. More details about method here: https://developer.servicenow.com/dev.do#!/learn/learning-plans/orlando/new_to_servicenow/app_store_learnv2_automatingapps_orlando_generating_events
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2021 11:55 PM
Hi Rakesh,
Please follow below steps, change table as per your requirement.
Conditions : gs.hasRole("itil,sn_request_write") && gs.getUser().isMemberOf(current.assignment_group) && (current.request_item.variables.state == 'reject' || current.request_item.variables.onboarding_user_accesptence== 'Reject') && current.active == true
Script :
if(current.assigned_to !=''){
//Get RITM Object
var requestitemgr=new GlideRecord('sc_req_item');
requestitemgr.get('sys_id',current.request_item);
//Sent Notification
if(current.request_item.cat_item == 'Catalog item Sys id'){
gs.eventQueue('Add your Event name',requestitemgr,requestitemgr.variables.user,'');
requestitemgr.variables.state='Pending User Response';
requestitemgr.update();
}
gs.addInfoMessage(gs.getMessage("Asset User Acknowledgement is sent to user"));
}
else{
gs.addErrorMessage('Please assign ticket after please click Send Notification');
}
action.setRedirectURL(current);
//new EventNotificationTrigger().sendNotification('Add your Event name',requestitemgr,current.variables.user,'');
Please mark helpful/correct if applicable.
Regards,
JRY