Set field value in workspace

pallavigaik
Tera Contributor

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.

 

 

3 REPLIES 3

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.

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:

lauri457
Tera Sage

Any reason you are not using an onload client script (this can also handle the infomessage) or a default value?


You can also fill values from the url using the query parm when creating new records just like in classic ui: /now/sow/record/incident/-1/params/query/short_description=helloworld%5Edescription=foobar


lauri457_0-1776407104525.png