<h2>action - getGlideURI()</h2><br/><div style="overflow-x:auto"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta content="text/html; charset=UTF-8" /><meta name="copyright" content="(C) Copyright 2026" /><meta name="DC.rights.owner" content="(C) Copyright 2026" /><meta name="generator" content="DITA-OT" /><meta name="DC.type" content="concept" /><meta name="DC.title" content="action - Scoped, Global" /><meta name="abstract" content="The action API provides methods to handle data for URLs in a UI action script." /><meta name="description" content="The action API provides methods to handle data for URLs in a UI action script." /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-server.html" /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-implementation-reference.html" /><meta name="DC.relation" scheme="URI" content="../../../../../build/applications/concept/api-reference.html" /><meta name="DC.creator" content="ServiceNow" /><meta name="DC.date.created" content="2023-08-03" /><meta name="DC.date.modified" content="2024-08-01" /><meta name="DC.format" content="XHTML" /><meta name="DC.identifier" content="ActionAPIBoth" /><link rel="stylesheet" type="text/css" href="../../../../../CSS/commonltr.css" /><title>action - Scoped, Global</title></head><body class="api-class"> <div class="nested0" id="ActionAPIBoth"> <h1 class="title topictitle1" id="ariaid-title1">action - Scoped, Global</h1> <div class="body conbody"><p class="shortdesc">The <span class="keyword apiname">action</span> API provides methods to handle data for URLs in a UI action script.</p> <div class="section" id="ActionAPIBoth__section_zh2_b4d_lmb"> <p class="p">Use this API to configure UI actions with which users can interact. Use these scripts in the UI Action [sys_ui_action] table. For information, see <a class="xref" href="https://www.servicenow.com/docs/access?context=t_EditingAUIAction&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US" target="_blank" rel="noopener noreferrer">UI actions</a>.</p> <p class="p">Methods for this API are referred to by the variable name 'action' in any server-side JavaScript. To learn more, see <a class="xref" href="https://developer.servicenow.com/blog.do?p=/post/training-ui-action-101/" target="_blank" rel="noopener noreferrer">Creating interactions with UI actions</a>.</p> </div> </div> <div class="related-links"> <div class="familylinks"> <div class="parentlink"><strong>Parent Topic:</strong> <a class="link" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/build/applications/concept/api-server.html" title="Use server APIs in scripts to change the functionality of applications, or when you create new applications.">Server API reference</a></div> </div> </div><div class="topic reference nested1 api-method" id="Action_getGlideURI"> <h2 class="title topictitle2" id="ariaid-title2">action - getGlideURI()</h2> <div class="body refbody"><p class="shortdesc">Gets a GlideURI object to determine the user view.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getGlideURI__table_dxr_lfj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 1. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e137">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e140">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e143">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e137 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e140 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e143 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getGlideURI__table_exr_lfj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 2. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e178">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e181">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e178 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e181 ">GlideURI object representing the URI parameter of the user view.<ul class="ul" id="Action_getGlideURI__ul_f4h_5lj_5mb"><li class="li"><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/GlideURIScoped/concept/c_GlideURIScopedAPI.html" title="The GlideURI API provides methods to handle URI parameters in a scoped application.">GlideURI - Scoped</a></li><li class="li"><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/GlideURIGlobal/concept/GlideURIGlobalAPI.html" title="The GlideURI API provides methods to handle URI parameters in a global application.">GlideURI - Global</a></li></ul> <div class="p"><div class="note"><span class="notetitle">Note:</span> Any other returned value is considered an error, including null.</div> </div> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">The following example shows how to get the user view and set the redirect URL to the service catalog home page.</p> <pre class="pre codeblock"><code>var uri = action.getGlideURI(); var path = 'catalog_home.do'; uri.set('sysparm_view', 'catalog_default'); action.setRedirectURL(uri.toString(path));</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_getReturnURL"> <h2 class="title topictitle2" id="ariaid-title3">action - getReturnURL()</h2> <div class="body refbody"><p class="shortdesc">Gets the URL of the return page in view after a UI action is complete.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getReturnURL__table_db4_ffj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 3. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e285">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e288">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e291">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e285 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e288 "> </td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e291 "> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getReturnURL__table_eb4_ffj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 4. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e326">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e329">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e326 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e329 ">URL of the return page in view after a UI action is complete.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>action.getReturnURL();</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_getURLParameter_S"> <h2 class="title topictitle2" id="ariaid-title4">action - getURLParameter(String parameterName)</h2> <div class="body refbody"><p class="shortdesc">Gets the value of a URL parameter.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getURLParameter_S__table_alv_y2j_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 5. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e404">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e407">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e410">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e404 ">parameterName</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e407 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e410 ">Name of the URL parameter name to be queried for the URL parameter value.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_getURLParameter_S__table_blv_y2j_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 6. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e447">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e450">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e447 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e450 ">URL parameter value.</td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>action.getURLParameter('sysparm_query');</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_openGlideRecord_O"> <h2 class="title topictitle2" id="ariaid-title5">action - openGlideRecord(Object gr)</h2> <div class="body refbody"><p class="shortdesc">Opens a page with a GlideRecord in the user view.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_openGlideRecord_O__table_sy5_bfj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 7. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e521">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e524">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e527">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e521 ">gr</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e524 "><a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/glideRecordScoped/concept/c_GlideRecordScopedAPI.html" title="The scoped GlideRecord API is used for database operations.">GlideRecord</a></td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e527 ">GlideRecord of the page to be opened in the user view.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_openGlideRecord_O__table_ty5_bfj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 8. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e572">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e575">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e572 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e575 "> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">The following example shows how to include the caller name and incident description created from an interaction record. For more details, see <a class="xref" href="https://www.servicenow.com/docs/access?context=declarative-actions-landing&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Customizing Configurable Workspace with declarative actions</a>.</p> <pre class="pre codeblock"><code>if(current.update()){ var inc = new GlideRecord("incident"); inc.newRecord(); inc.caller_id = current.opened_for; inc.short_description = current.short_description; action.openGlideRecord(inc); }</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_setNoPop_B"> <h2 class="title topictitle2" id="ariaid-title6">action - setNoPop(Boolean noPop)</h2> <div class="body refbody"><p class="shortdesc">Indicates whether to enable or disable pop-up windows on the page in the current view.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setNoPop_B__table_mms_gfj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 9. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e657">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e660">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e663">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e657 ">noPop</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e660 ">Boolean</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e663 ">Flag indicating whether to enable or disable pop-up windows on the page:<ul class="ul" id="Action_setNoPop_B__ul_qmz_fwj_nkb"><li class="li">true: Disables pop-up windows.</li><li class="li">false: Default. Enables pop-up windows.</li></ul> </td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setNoPop_B__table_nms_gfj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 10. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e708">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e711">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e708 ">None</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e711 "> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">The following example shows how to disable pop-up windows for a UI action.</p> <pre class="pre codeblock"><code> action.setNoPop(true);</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_setRedirectURL_O"> <h2 class="title topictitle2" id="ariaid-title7">action - setRedirectURL(Object URL)</h2> <div class="body refbody"><p class="shortdesc">Sets the redirect URI for this transaction, which determines the next page the user sees.</p> <div class="section" id="Action_setRedirectURL_O__section_xvk_5wd_lmb"> <div class="p">For use cases: <ul class="ul" id="Action_setRedirectURL_O__ul_i1s_2qk_lmb"><li class="li"><a class="xref" href="https://www.servicenow.com/docs/access?context=useful-client-side-scripts&version=xanadu&pubname=xanadu-application-development&section=t_CreateAUIRoutingAction&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Create a UI routing action</a></li><li class="li"><a class="xref" href="https://www.servicenow.com/docs/access?context=ui-action-hrcase-article&version=xanadu&pubname=xanadu-servicenow-platform&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Create knowledge articles from HR cases</a></li><li class="li"><a class="xref" href="https://www.servicenow.com/docs/access?context=r_UIActions&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Task relationships with UI actions</a></li></ul> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setRedirectURL_O__table_bdm_2fj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 11. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e807">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e810">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e813">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e807 ">URL</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e810 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e813 ">URL to set as the redirect. You can provide the URL as a string or a <a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/glideRecordScoped/concept/c_GlideRecordScopedAPI.html" title="The scoped GlideRecord API is used for database operations.">GlideRecord</a>. If you pass the URL as a GlideRecord, this value takes the focus to that record's form.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setRedirectURL_O__table_cdm_2fj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 12. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e860">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e863">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e860 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e863 "> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">The following example shows how to redirect a user to a URL from a UI action using the <a class="xref" href="https://www.servicenow.com/docs/access?context=c_ScriptableServiceCatalogVariables&version=xanadu&pubname=xanadu-application-development&ft:locale=en-US" target="_blank" rel="noopener noreferrer">current</a> variable.</p> <pre class="pre codeblock"><code>var fixchg = new GlideRecord("change_request"); fixchg.short_description= current.short_description; fixchg.comments= current.comments.getHTMLValue(); // fixchg.parent = current.sys_id; fixchg.insert(); FixChange(); gs.addInfoMessage("Change "+ fixchg.number+" created"); action.setRedirectURL(current); action.setReturnURL(fixchg); function FixChange(){ var m2m = new GlideRecord('task_rel_task'); m2m.initialize(); m2m.child= current.sys_id; m2m.parent= fixchg.sys_id; m2m.type.setDisplayValue("Fixes::Fixed by"); m2m.insert();}</code></pre> </div> <div class="example"> <div class="p">The following example shows how to create a new incident record and redirect to the new incident after a UI action completes.<pre class="pre codeblock"><code>var reqItem = current.u_item; var requestedFor = current.u_requested_for; var location = current.location; if(current.u_incident_request == 'Incident'){ //Create a new incident record and redirect to the new incident var rec = new GlideRecord('incident'); rec.initialize(); rec.caller_id = requestedFor; rec.location = location; rec.insert(); action.setRedirectURL(rec); } if(current.u_incident_request == 'Request'){ //Build the url and route the user to the request item var url = ''; if(current.u_item.sys_class_name == 'sc_cat_item_guide'){ url = 'com.glideapp.servicecatalog_cat_item_guide_view.do?sysparm_initial=true&sysparm_guide=' + reqItem + '&sysparm_user=' + requestedFor + '&sysparm_location=' + location; } else{ url = 'com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + reqItem + '&sysparm_user=' + requestedFor + '&sysparm_location=' + location; } action.setRedirectURL(url); }</code></pre></div> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_setReturnURL_O"> <h2 class="title topictitle2" id="ariaid-title8">action - setReturnURL(Object URL)</h2> <div class="body refbody"><p class="shortdesc">Sets the return URI for this transaction after a UI action is complete. You can use this method to determine what page the user has in view when they return from submit.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setReturnURL_O__table_bdm_2fj_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 13. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e952">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e955">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e958">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e952 ">URL</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e955 ">Object</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e958 ">URI to set as the return location after a UI action is complete. You can provide the URL as a string or a <a class="xref" href="https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/glideRecordScoped/concept/c_GlideRecordScopedAPI.html" title="The scoped GlideRecord API is used for database operations.">GlideRecord</a>.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setReturnURL_O__table_cdm_2fj_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 14. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1005">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1008">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1005 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1008 "> </td></tr></tbody></table> </div> </div> <div class="example"> <p class="p">The following example enables the user to select the UI action to create a change record using information from the problem record and the change template. After the change, the user returns to <a class="xref" href="https://www.servicenow.com/docs/access?context=c_ScriptableServiceCatalogVariables&version=xanadu&pubname=xanadu-application-development&ft:locale=en-US" target="_blank" rel="noopener noreferrer">current</a> view. For more information, see <a class="xref" href="https://www.servicenow.com/docs/access?context=r_ScriptedTemplates&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Scripted templates</a>. For more use cases, see <a class="xref" href="https://www.servicenow.com/docs/access?context=r_UIActions&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US" target="_blank" rel="noopener noreferrer">Task relationships with UI actions</a>.</p> <pre class="pre codeblock"><code>var change = new GlideRecord("change_request"); change.initialize(); change.short_description = current.short_description; change.description = current.u_details; change.cmdb_ci = current.u_service; change.priority = current.priority; change.requested_by = current.caller_id; change.assignment_group.setDisplayValue('Change & Release'); change.u_status = 'New'; change.parent = current.number; change.applyTemplate("standard_rfc"); current.rfc = change.insert(); current.comments = 'Change ' + change.number + ' created.'; var mySysID = current.update(); gs.addInfoMessage("Change " + change.number + " created"); action.setRedirectURL(change); action.setReturnURL(current);</code></pre> </div> </div> </div> <div class="topic reference nested1 api-method" id="Action_setURLParameter_S_S"> <h2 class="title topictitle2" id="ariaid-title9">action - setURLParameter(String parameterName, String parameterValue)</h2> <div class="body refbody"><p class="shortdesc">Sets a URL parameter name and value.</p> <div class="section"> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setURLParameter_S_S__table_elv_z2j_nkb" class="table parameters" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 15. </span>Parameters</span></caption><colgroup><col /><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1096">Name</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1099">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1102">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1096 ">parameterName</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1099 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1102 ">Name of the URL parameter.</td></tr><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1096 ">parameterValue</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1099 ">String</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1102 ">Value of the parameter.</td></tr></tbody></table> </div> <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="Action_setURLParameter_S_S__table_flv_z2j_nkb" class="table returns" frame="border" border="1" rules="all"><caption><span class="tablecap"><span class="table--title-label">Table 16. </span>Returns</span></caption><colgroup><col /><col /></colgroup><thead class="thead" style="text-align:left;"><tr class="row"><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1151">Type</th><th class="entry cellrowborder" style="vertical-align:top;" id="d1091510e1154">Description</th></tr></thead><tbody class="tbody"><tr class="row"><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1151 ">void</td><td class="entry cellrowborder" style="vertical-align:top;" headers="d1091510e1154 "> </td></tr></tbody></table> </div> </div> <div class="example"> <pre class="pre codeblock"><code>action.setURLParameter('sysparm_query', 'priority=2^active=true');</code></pre> </div> </div> </div> </div> </body></html></div>