how to send notification by clicking UI action button

RC8
Kilo Guru

Iam having a button called send notification when iam clicking that button notification has to be send to the user ??

7 REPLIES 7

@Rakesh chowdary 

Please follow the below links and you should be able to achieve this.

It would be learning exercise for you as well.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Pushpa Yadav1
Tera Guru

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

 

JRY
Mega Guru

Hi Rakesh,

Please follow below steps, change table as per your requirement.

find_real_file.png

 

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