action.setRedirectURL to create a new record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2018 08:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2018 11:49 AM
You can populate values by passing parameters in the URL.
This article should help: 3 Ways to Populate Values in ServiceNow via the URL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2018 12:48 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2018 02:11 PM
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");