I have created a Scriptinclude and onChange client script but it is not working

kranthi2
Tera Expert

Hi,

I have created a Scriptinclude and onChange client script but it is not working, i suppose to set the user's location.

but it is not happening.

onChange Client script:

kranthi2_0-1748580072890.png

 

Scriptinclude:

 

kranthi2_1-1748580118123.png

 

User form:

kranthi2_2-1748580251145.png

If i select user from the reference then location is not auto populating.

 

kranthi2_3-1748580309723.png

Thanks,

 

 

 

 

 

1 ACCEPTED SOLUTION

YaswanthKurre
Giga Guru

Hi Kranthi,

Please make sure to include the function name you're calling from the Script Include in your Client Script.
You can add the following line after line 7:

 

<< - add this--> ga.addParam('sysparm_name', 'populateLocation');

 

Give it a try and let me know how it goes.

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@kranthi2 

your GlideAjax syntax is wrong, you are not calling the function itself

check these links and update

GlideAjax - Client 

GlideAjax Example Cheat Sheet 

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

YaswanthKurre
Giga Guru

Hi Kranthi,

Please make sure to include the function name you're calling from the Script Include in your Client Script.
You can add the following line after line 7:

 

<< - add this--> ga.addParam('sysparm_name', 'populateLocation');

 

Give it a try and let me know how it goes.

Robert H
Mega Sage

Hello @kranthi2 ,

 

Apart from the scripting issue, can you please explain what you are trying to achieve, i.e. what is the requirement?

 

I see you have created a custom reference field "User Name" on the User table itself. What is the purpose of referencing a User with another User here?

 

Regards,

Robert

Hi @Robert H  

I want to achieve that If any user is selected then location should be auto populate.

 

Thanks