We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

on change client script is not working on service operations workspace

suryaogeti1
Tera Contributor

on change client script is not working on service operations workspace

I need to auto populate the location, when caller is selected, but it is not working, please help me with this

function onChange(control, oldValue, newValue, isLoading) {
   if ((isLoading && !g_form.isNewRecord()) || (g_form.isLiveUpdating && g_form.isLiveUpdating()))
      return;

   if (newValue == '' || newValue == null) {
      g_form.clearValue('location');
      return;
   }
   if (!g_form.hasField('location'))
      return;
   var caller = g_form.getReference('u_caller', setLocation);
}

function setLocation(caller) {
   if (caller && caller.location)
       g_form.setValue('location', caller.location);
}
2 ACCEPTED SOLUTIONS

Hi @suryaogeti1 ,
under view name select service operations workspace new record and make changes there
Screenshot 2026-04-14 at 8.37.48 PM.png

View solution in original post

Hi @suryaogeti1 ,
1.Right click on form header, Configure >> form builder.
Screenshot 2026-04-14 at 9.21.42 PM.png

2.Select the view and scroll down to see the section you want to delete
Screenshot 2026-04-14 at 9.20.26 PM.png
3.Click on the trash icon to delete the section
4.Now click on save(top-right corner)

View solution in original post

12 REPLIES 12

Ankur Bawiskar
Tera Patron

@suryaogeti1 

Did you set UI Type - All?

Did you add alert and see in that script?

Are you sure the script is running for all views?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

it is working in normal UI but not in SOW, i set up ui type all

Rakesh_M
Mega Sage

Hi @suryaogeti1 ,
This is (BP) Set Location to User - OOTB Client script .
Did you create a new client script for this functionality? or using existing OOTB one?

I have used the existing code, previously it was for incident, now i am using it for interaction table.