Auto populate user details in customized filed on incident table

shaikkhasim
Tera Contributor

Hi Team

i have created a custom filed on incident form-- filed name is (u_t_id).. need to auto populate caller details in that filed 

i have used client script on load, but it shows un identified 

 

client script on load 

function onLoad() {
   //Type appropriate comment here, and begin script below

   var d=g_user.userID;
   g_form.setValue("caller_id",d);
   var c1=g_form.getValue("caller_id");
   g_form.setValue("u_t_id",c1.user_name);
 
Regards
Khasim

 

 

khasim
6 REPLIES 6

AndersBGS
Tera Patron
Tera Patron

Hi @shaikkhasim ,

 

You can't dot-walk in a client script. If you need to have information from another table, you need to create a script include which is callable from a client script, or a business rule which runs server side. So basic question is, if you need to populate the name in "u_t_id" on client side or you can wait until server side? 

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Hi Anders

 

i need to call in client side only 

 

Regards

khasim

 

khasim

Hi @shaikkhasim ,

 

As stated earlier, not possible to dot-walk in client side only.

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.

 

Best regards

Anders

If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.

Best regards
Anders

Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

Ankur Bawiskar
Tera Patron
Tera Patron

@shaikkhasim 

custom field is of what type?

why to have field to store info of caller when there is already caller_id field on INC form?

Are you setting caller_id with logged in user when form loads?

You will have to write onChange client script on Caller field OR use before update BR to set the field value

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader