Set field value in workspace

pallavigaik
Kilo Guru

Hi All,

 

I have created a page variant to create a new record in custom table. In rate type field I want to pre-populate a default value whenever form get loaded.

 

For this requirement I have added [field] set value handler under From loading state changed.

pallavigaik_0-1776404109008.png

 

So, when I preview the configured page, It is showing expected result, like alert is getting printed, field value is getting set to Fixed rate

pallavigaik_1-1776404259542.png     

pallavigaik_2-1776404288938.png

 

 

However when I'm opening URL page, its neither printing alert nor setting field value. Seems events are not getting triggered on URL page.  Why this is happening. Please help me to fix this issue. 

 

Thanks in advance for your support.

 

 

1 ACCEPTED SOLUTION

Hi @lauri457,

Thank you for reverting. Now I got it.

 

Actually I had configured classic onLoad client script, but it was working on form UI not on workspace. Reason of this issue was that I  had select Desktop in UI type. Later I set UI type to All and then it started working on workspace too. 

View solution in original post

8 REPLIES 8

Dinesh Chilaka
Kilo Sage

Hi @pallavigaik ,

The reason is whenever if we open the page in URL Path it will open the page variant which is having lowest order if no conditions are set. You have duplicated the OOB page right, did you inactivated the OOB page or not?

If not try to reduce the order of your newly created variant.

1.Open the duplicated page variant in UI Builder,Click on settings

Screenshot 2026-04-17 at 11.37.54 AM.png

2.Modify the order with less than the OOB page variant order and save the variant.

Screenshot 2026-04-17 at 11.38.53 AM.png

Now check the result by opening the page using open URL path.

If my response helped, mark it as helpful and accept the solution.

Hi @Dinesh Chilaka 

Thank you for reverting. I didn't copy the variant. Have created it from scratch. 

Tanushree Maiti
Kilo Patron

Hi @pallavigaik 

 

Check this link if it helps:

https://www.servicenow.com/community/developer-forum/ui-builder-client-script-is-not-running-on-page...

 

https://www.servicenow.com/community/next-experience-forum/ui-builder-client-script-to-set-form-fiel....

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

Hi @Tanushree Maiti 

Thank you for reverting. I tried by adding an event handler for record fetch completed. Still it's not working