action.setRedirectURL to create a new record

tahnalos
Kilo Sage

One of my UI Actions creates a new child record that has to be filled in.  On this UI action, it uses GlideDialogForm to create this new record.

I am aware that this is not possible under Mobile UI as it requires Server side processing and GlideDialogForm is client side.  My first instinct would be to use action.setRedirectURL (record) however, I realize that I need to instantiate the record as a child with the sys_id of the parent as the reference.  Any idea how I can pull this off?

 

Thanks

3 REPLIES 3

Lee Epps
Tera Guru

You can populate values by passing parameters in the URL.

This article should help: 3 Ways to Populate Values in ServiceNow via the URL

Thanks for your help.  However, I actually need to pass two parameters into this child record, not one.

One of the comments in that link has the following code:

 

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

action.setRedirectURL("./project_status.do?sys_id=-1&sysparm_query=achievements_last_week=test"); // This also works

 

But he wants them combined into one line.  Ideas?

You can link the parameters together with a caret. This should fill in both fields for the same record:

action.setRedirect("./project_status.do?sys_id=-1&sysparm_query=project=" + current.sys_id + "^achievements_last_week=test");