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

@kranthi2 

what's the business requirement to have user reference field on sys_user table itself?

Are you trying to learn and explore something or this is for a customer's requirement?

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

Hi @Ankur Bawiskar 

Here, it is not a business requirement i am learning for my self from basic level.

Thanks

@kranthi2 

then link I shared talks how to use correct GlideAjax, refer that and fix the code please

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

Hello @kranthi2 ,

 

Yes, that is understood, but what's the logical reason for having a user's location being populated from another user?

This is highly unusual.

 

Regards,

Robert

Hi @Robert H  These is no logic here i am learning this Glideajax by creating 2 fields and populating the location based on the user is selected into the UserName

 

Can you please help me