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

mdavis933
Mega Expert

Hi Steve 

 

I would think that you can make this via GlideAjax... So basically you will send the data to the redirected field.... See more about GlideAjax here  https://community.servicenow.com/community?id=community_article&sys_id=9f7ce2e1dbd0dbc01dcaf3231f961....

and for the redirect, it could be something like

 

action.setRedirectURL("URL");

** Be sure the UI action has the "Client" unchecked as the set Redirect runs on the server side from what I know

 

 

 

Harsh Vardhan
Giga Patron

Willem
Giga Sage
Giga Sage

Hi Steve,

 

You can redirect to a form and via the URL already set some values. You can use:

var url = "https://<instance name>.service-now.com/nav_to.do?uri=<tablename>.do?sys_id=-1%26sysparm_query=<field>=<value>^<field2>=<value2>"
    action.setRedirectURL(url);

Change the Table name to the table you want. The sys_id=-1 means it will open a "Create new" form. And in the sysparm_query= part you can add fields=value pairs.

 

This way the fields are filled in, but the record is not saved into the system until the user is done.

 

Let me know if you have any questions.

I tried to use this with my info but it just flashes when I click the button and goes blank. Am I doing it wrong?

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

action.setRedirectURL(url);