- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2024 10:50 PM
Hi ALL,
i want to update caller's email and department name in short description when ever a incident record created on snow.
can any one help me with that?
Thanks,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 09:36 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 12:29 AM
sample code for client script + GlideAjax
var UpdateCallerInfo = Class.create();
UpdateCallerInfo.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getCallerInfo: function() {
var caller = new GlideRecord('sys_user');
if (caller.get(this.getParameter('sysparm_caller'))) {
var callerEmail = caller.email.toString();
var callerDepartment = caller.department.getDisplayValue();
var result = {
email: callerEmail,
department: callerDepartment
};
return JSON.stringify(result);
}
return null;
}
});
Client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var ga = new GlideAjax('UpdateCallerInfo');
ga.addParam('sysparm_name', 'getCallerInfo');
ga.addParam('sysparm_callerId', newValue);
ga.getXMLAnswer(function(response) {
var result = JSON.parse(response);
if (result) {
var shortDescription = 'Email: ' + result.email + ', Department: ' + result.department;
g_form.setValue('short_description', shortDescription);
}
});
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 12:43 AM
I hope I have provided a thorough answer to your question. I'm confident that with your developer skills, you can take it further from here.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-24-2024 09:36 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader