Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var aj = new GlideAjax("GetCallerDetails"); // This is the name of script include, as per the name of your requirement.
aj.addParam('sysparm_name',"demoTest"); // This is calling a defined function in script include.
aj.addParam('sysparm_caller_id',g_form.getValue('caller_id')); // getting a caller_id
aj.getXML(callback);
function callback(response){ // creating a callback function to store the response getting from script include.
var answer = response.responseXML.documentElement.getAttribute('answer');
alert(answer); // This will alert the details.
}

}
1 change: 1 addition & 0 deletions Script Includes/GetCallerDetails/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This script include will help to get the details of caller Id_name like (email, first_name, last_name user_name etc.) mentioned in incident form with the help of on change client script by iniating a Ajax call.
14 changes: 14 additions & 0 deletions Script Includes/GetCallerDetails/scriptinclude.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
var GetCallerDetails = Class.create(); // This will create a new class.
GetCallerDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
demoTest:function(){
var caller = this.getParameter('sysparm_caller_id'); // this will make the instance for caller id
var user = new GlideRecord('sys_user');
user.addQuery('sys_id',caller); // This will query the parameter, if exist
user.query();
if(user.next()){ // If user found
return "Email Id: " + user.email + "\n" + "First Name " + user.first_name + "\n" + "Last Name: " + user.last_name + "\n" + "User Id: " + user.user_name;
}
},

type: 'GetCallerDetails'
});