Need to update the field values and submit the form onLoad

Shweta Gadkar
Kilo Contributor

I am looking for a way to submit a form onload. I am fetching the values from a 3rd party tool via integration. I got the values in the CS but not sure how do I make the form as submitted.

Conditions in the code looks something like below. I want to set the fields and then submit the form.

 

if(response=="authorized")
{
        g_form.setValue('alm_user',true);
}

Any help is highly appreciated!

1 ACCEPTED SOLUTION

Shubham Tipnis
Kilo Sage
Kilo Sage

Hi Shweta,

 

This looks a straightforward scenario to me.

Have you checked the g_form.submit() method. It will simply submit the form when the conditions are met. This is fine if you want this to be achieved using onload cs.

 

Add it in the code like below.

if(response=="authorized")
{
        g_form.setValue('alm_user',true); 
        g_form.submit();

}

 

 

Regards,
Shubham

Regards,
Shubham Tipnis
 ServiceNow Enthusiast
️ 3x Rising Star (2022–2024) – ServiceNow Community
 Sharing insights, use cases & real-world learnings from the Now Platform
 Always learning. Always building.

View solution in original post

2 REPLIES 2

Shubham Tipnis
Kilo Sage
Kilo Sage

Hi Shweta,

 

This looks a straightforward scenario to me.

Have you checked the g_form.submit() method. It will simply submit the form when the conditions are met. This is fine if you want this to be achieved using onload cs.

 

Add it in the code like below.

if(response=="authorized")
{
        g_form.setValue('alm_user',true); 
        g_form.submit();

}

 

 

Regards,
Shubham

Regards,
Shubham Tipnis
 ServiceNow Enthusiast
️ 3x Rising Star (2022–2024) – ServiceNow Community
 Sharing insights, use cases & real-world learnings from the Now Platform
 Always learning. Always building.

Thanks @Shubham Tipnis . this worked perfectly !