onchange client script

Sakshi86
Tera Contributor

how to populate the caller manager details in to the short description field.

3 REPLIES 3

Manikmodi16
Tera Guru

Hi,

This can be achieved by creating an OnChange Client Script on the Caller Manager field and then use the below code in your script to set the value:

 

 


function onChange(control, oldValue, newValue, isLoading) {
   g_form.setValue('short_description', newValue);
}

 

 

If you find this helpful, please mark this reply as the solution. Thanks!

Brad Bowman
Kilo Patron
Kilo Patron

Use GlideAjax in the onChange Client Script to call a Script Include, passing in the caller (sys_id).  The SI will query the user table to get the manager record, then you can build an object of the fields from the manager record that you want to return to the client to populate in the text field.  Here's an excellent guide

https://www.servicenow.com/community/developer-articles/glideajax-example-cheat-sheet-updated/ta-p/2... 

Give the scripts a shot and post them if you get stuck.

Mark Roethof
Tera Patron
Tera Patron

Hi there,

 

Is this in platform ui? Or perhaps portal? Or somewhere else (since you are posting this under Virtual Agent).

 

If this is for example portal, there might be other (no code) options than for coded platform UI options. So please be more specific so we can help you correctly.

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn