
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020 06:25 AM
Hi Team,
Could you please check, what I am missing in my UI Action Code.
Issue:
The prompt window is coming, but Notification is Not getting Triggered.
Requirement:
Table: SC_task, Need To have a Prompt window and if we enter some value, Notification will get trigger.
Code:
Regards,
Priya
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2020 11:34 PM
Glad that it worked. Please mark answer as correct and helpful.
unfortunately you cannot send value of prompt box which user gave from client side to server side.
Also since you are not updating anything from server side just sending event you can make the UI action only client side
Approach below:
1) one user gives the email in prompt box; get the value
2) Write GlideAjax call in that client side code and pass the email, comments, record sysid
3) in the script include function updated the record using the sys_id and then get the email address given by user in prompt box and include that in event queue
Updated UI Action:
function promptUser(){
var con = prompt("Please enter some value to trigger notification");
if(con != null){
var ga = new GlideAjax('sendEmailUtils');
ga.addParam('sysparm_name', 'sendEmail');
ga.addParam('sysparm_email', con);
ga.addParam('sysparm_comments', 'Test test');
ga.addParam('sysparm_sys_id', g_form.getUniqueValue());
ga.getXML(processResponse);
function processResponse(response) {
var result = response.responseXML.documentElement.getAttribute("answer");
}
}
else{
return false;
}
}
Sample Script Include: Client Callable
var sendEmailUtils = Class.create();
sendEmailUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
sendEmail: function(){
var email = this.getParameter('sysparm_email');
var comments = this.getParameter('sysparm_comments');
var sysId = this.getParameter('sysparm_sys_id');
var gr = new GlideRecord('sc_task');
gr.get(sysId);
gr.comments = comments;
gr.update();
gs.eventQueue("onboard.welcome.event", gr,gr.request_item.variables.external_contact_email);
gs.eventQueue("onboard.welcome.event.pass", gr,gr.request_item.variables.external_contact_email);
},
type: 'sendEmailUtils'
});
Mark as Correct Answer & Helpful if this solves your issue or Helpful if this is useful to you.
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
07-10-2020 04:20 AM
Hi Ankur,
Thank you for all your efforts and Time!!! 🙂
I am really Glad for your Response!!!.
Just very tiny modification I did on this code and start working per my expectation.
Regards,
Priya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2020 04:41 AM
Glad that it worked.
You are welcome.
Cheers..!!
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
07-10-2020 04:22 AM
Hi Ankur,
I am making this response as helpful because this was also working as per my previous requirement.
Thank you for your efforts!!
Regards,
Priya