Opened by's mobile number

anilwillpower
Tera Contributor

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

2 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @anilwillpower 

 

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]

****************************************************************************************************************

View solution in original post

Anurag Tripathi
Mega Patron
Mega Patron

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;
      }

});

 

 

-Anurag

View solution in original post

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @anilwillpower 

 

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]

****************************************************************************************************************

Anurag Tripathi
Mega Patron
Mega Patron

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;
      }

});

 

 

-Anurag