UI Action - How do I redirect to a form and fill out a field?

ServiceNowSteve
Giga Guru

Like the title says I would like to create a new form button that if clicked would re-direct me to a different module inside the platform and also fill out a field. I have looked at a few other posts on this topic but none of them seem to really be what I am looking for.

 

Any suggestions on how I may be able to do this?

1 ACCEPTED SOLUTION

Can you try it like this?

var url = "https://MYINSTANCE.service-now.com/u_new_asset.do?sysparm_stack=u_new_asset.do?sys_id=-1%26sysparm_query=u_operation=modify_record^u_select_record=TRP-96J194700345";
    action.setRedirectURL(url);

As suggested by the guru:

https://www.servicenowguru.com/service-now-general-knowledge/populating-default-values-url-module/

View solution in original post

9 REPLIES 9

did you access field value and then set it on url ?

eg:

 

action.setRedirectURL("./project_status.do?sys_id=-1&sysparm_query=project=" + current.sys_id); // This works

Can you try it like this?

var url = "https://MYINSTANCE.service-now.com/u_new_asset.do?sysparm_stack=u_new_asset.do?sys_id=-1%26sysparm_query=u_operation=modify_record^u_select_record=TRP-96J194700345";
    action.setRedirectURL(url);

As suggested by the guru:

https://www.servicenowguru.com/service-now-general-knowledge/populating-default-values-url-module/

It brought me to the correct form but it didn't populate the fields. I tried to use the label and the name of the field but it stays blank. I even tried removing the second parameter to just keep it simple but still nothing. Weird.

I figured out the problem thanks to your servicenowguru link. Do not add %26 after the sys_id=-1 instead just make it sys_id=-1&sysparm_query=BLAH

 

Thank you!

@Willem Where to write this code on the Submit UI Action Widget?