- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 03:34 AM
when ever opened by is populated or changed opened by mobile number has to be populated with the mobile number on the corresponding user record. By using GlidAjax
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 06:20 AM
Do you want to do this on Form, then just dot walk to openedby.phone number it will populate or if you want to do via catalog item ,then you can use Auto Populate feature on variable.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 06:38 AM - edited ‎02-26-2024 06:39 AM
Hi,
what Atul suggested makes sense, you can just add the dot walked field from on Behalf of on the form and make it read only.
how ever if you want to use the scripts here is an example
Client script
var ga = new GlideAjax('HelloWorld'); // HelloWorld is the script include class
ga.addParam('sysparm_name','helloWorld'); // helloWorld is the script include method
ga.addParam('sysparm_user_name', g-form.getValue('<opened By field>'));
ga.getXML(HelloWorldParse);
// the callback function for returning the result from the server-side code
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('<field you want to populate>', answer);
}
Script include
var HelloWorld= Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld: function () {
var usr= this.getParameter('sysparm_user_name');
var mo= new GlideRecord('sys_user');
mo.get(''+usr);
return mo.mobile_phone;
}
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 06:20 AM
Do you want to do this on Form, then just dot walk to openedby.phone number it will populate or if you want to do via catalog item ,then you can use Auto Populate feature on variable.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-26-2024 06:38 AM - edited ‎02-26-2024 06:39 AM
Hi,
what Atul suggested makes sense, you can just add the dot walked field from on Behalf of on the form and make it read only.
how ever if you want to use the scripts here is an example
Client script
var ga = new GlideAjax('HelloWorld'); // HelloWorld is the script include class
ga.addParam('sysparm_name','helloWorld'); // helloWorld is the script include method
ga.addParam('sysparm_user_name', g-form.getValue('<opened By field>'));
ga.getXML(HelloWorldParse);
// the callback function for returning the result from the server-side code
function HelloWorldParse(response) {
var answer = response.responseXML.documentElement.getAttribute("answer");
g_form.setValue('<field you want to populate>', answer);
}
Script include
var HelloWorld= Class.create();
HelloWorld.prototype = Object.extendsObject(AbstractAjaxProcessor, {
helloWorld: function () {
var usr= this.getParameter('sysparm_user_name');
var mo= new GlideRecord('sys_user');
mo.get(''+usr);
return mo.mobile_phone;
}
});