Get Caller Details using Script Include | Client Scripts | Script Includes | ServiceNow

  Рет қаралды 2,269

LearnIT

LearnIT

Жыл бұрын

For More Information, please check details below:
In this session, I have explained how to return multiple values from the script include and pass it to the client side.
Script Type - Client Scripts & Script Includes
Table - Incident
Type - onChange based on Caller
====================CLIENT SCRIPT======================
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
// if (isLoading || newValue === '') {
// return;
// }
//Type appropriate comment here, and begin script below
var ga1 = new GlideAjax('FetchUserDetails');
ga1.addParam('sysparm_name', 'getData');
ga1.addParam('sysparm_user', newValue);
ga1.getXMLAnswer(setDetails);
function setDetails(response) {
var pVal = JSON.parse(response);
g_form.setValue('u_manager', pVal.manager);
g_form.setValue('u_user_s_location', pVal.location);
g_form.setValue('u_mobile_number', pVal.mobile_number);
g_form.setValue('u_username', pVal.username);
g_form.setValue('u_email', pVal.email);
}
}
====================SCRIPT INCLUDE======================
var FetchUserDetails = Class.create();
FetchUserDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getData: function() {
var user = this.getParameter('sysparm_user');
var obj = {};
var usr = new GlideRecord('sys_user');
usr.addQuery('sys_id', user);
usr.query();
if (usr.next()) {
obj.manager = usr.manager.getDisplayValue();
obj.location = usr.location.getDisplayValue();
obj.mobile_number = usr.mobile_phone.getDisplayValue();
obj.username = usr.user_name.getDisplayValue();
obj.email = usr.email.getDisplayValue();
}
return JSON.stringify(obj);
},
type: 'FetchUserDetails'
});
If you have any feedback related to the scripting part, please write it in the comment box.
My Playlists for Quick Access for Various Learning Paths:
ServiceNow Interview Questions - • Playlist
ServiceNow Scenario Based Solutions - • ServiceNow Scenario Ba...
ServiceNow Scripting - • ServiceNow Scripting
ServiceNow Advanced Concepts - • ServiceNow Advanced Co...
ServiceNow Concepts - • ServiceNow Concepts
ServiceNow Tips & Tricks - • Playlist
ServiceNow San Diego Release - • ServiceNow San Diego R...
ServiceNow Basics & Overview - • ServiceNow Basics & Ov...
ServiceNow App Engine Studio - • ServiceNow App Engine ...
ServiceNow Shorts - • ServiceNow Shorts
#servicenow #learnit #learnitbyprashant
Thanks for Visiting my Channel . Here I will be sharing all kinds of technical Knowledge. Anyone can connect with me directly for anything as part of ServiceNow Related Query.
Keep Supporting me so that I can continue to provide you good content each time!!😇🙏
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
Thank you for Watching My Videos!!!
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬

Пікірлер: 3
@kamaldeen3
@kamaldeen3 Жыл бұрын
u a top G
@Alekhya-dm5fd
@Alekhya-dm5fd Жыл бұрын
How to make onchange should also work for onload if i remove isloading from client script it's working but whenever form is saving everytime value is coming from backend even user changes the value how to resolve this
@learnitwithprashant
@learnitwithprashant Жыл бұрын
Connect me on WhatsApp 8130034935
GlideAjax in ServiceNow | Learn ServiceNow APIs
54:06
SAASWITHSERVICENOW
Рет қаралды 17 М.
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 56 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 56 МЛН
Khó thế mà cũng làm được || How did the police do that? #shorts
01:00
(Day 9)Script Include | Auto-Populate  | Uses of GlideAjax |  Real Time Scenarios
34:10
Learn ServiceNow with Ravi
Рет қаралды 7 М.
Call Script Include from Client Script in ServiceNow using GlideAjax
17:13
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 56 МЛН