<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question UI Action GlideModelForm passing values and callback in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100083#M1598</link>
    <description>&lt;P&gt;Hello Community,&lt;BR /&gt;&lt;BR /&gt;Until we implement HAM, I'm trying to build a UI Action to assign an asset from an sc_task (Catalog task form).&lt;BR /&gt;&lt;BR /&gt;I'm using a combination of a GlideModal "glide_prompt", to prompt for the asset tag along with a GlideModalForm to call the alm_hardware form.&amp;nbsp; I can get the initial prompt and a form to load, but not of the specific asset from the prompt.&lt;BR /&gt;&lt;BR /&gt;My code so far is below, but my use case is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;From sc_task/catalog task form, agent clicks UI action&lt;/LI&gt;&lt;LI&gt;UI Action generates prompt to input asset tag&lt;/LI&gt;&lt;LI&gt;UI Action loads specific asset tag form (alm_hardware)&lt;/LI&gt;&lt;LI&gt;UI action sets state to "in use"&lt;/LI&gt;&lt;LI&gt;UI action sets assigned_to to value of sc_task.request_item.requested_for&lt;/LI&gt;&lt;LI&gt;UI action closes sc_task on submit of GlideModalForm.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Like I said, I can get the initial prompt, the loading of a new asset (not of specific) and I can set the state but can't seem to figure out what I'm missing to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;load the specific asset form&lt;/LI&gt;&lt;LI&gt;get the variable of sc_task.request_item.requested_for&lt;/LI&gt;&lt;LI&gt;close the sc_task on callback.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's my code so far:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function scan_hardware(){
var gm = new GlideModal("glide_prompt", true, 600);
gm.setTitle("Scan Hardware");
gm.setPreference("title", "Asset Tag:");
gm.setPreference("onPromptComplete", function(value) {
	if (value!=""){
	var af= new GlideModalForm('Update Asset','alm_asset',''); //no callback yet
	var assetSID = value;
	af.setPreference('install_status',1) //set state to in use
	af.setPreference('asset_tag',assetSID);
	//af.setPreference('sys_id',assetSID);
	af.render();
	}else
	alert("you didn't enter a value!");
});
gm.setPreference("onPromptCancel", function(value) {alert("You clicked on 'Cancel', value was: "+value)});
gm.render();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I figure this out, my next question will be can you have two input boxes in the "glide_prompt" modal? I'd like to be able to scan for either asset tag or serial number, then use the input box who's value isn't =''&lt;BR /&gt;&lt;BR /&gt;Thanks everyone!&lt;/P&gt;</description>
    <pubDate>Fri, 08 Nov 2024 14:11:45 GMT</pubDate>
    <dc:creator>JGerrity</dc:creator>
    <dc:date>2024-11-08T14:11:45Z</dc:date>
    <item>
      <title>UI Action GlideModelForm passing values and callback</title>
      <link>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100083#M1598</link>
      <description>&lt;P&gt;Hello Community,&lt;BR /&gt;&lt;BR /&gt;Until we implement HAM, I'm trying to build a UI Action to assign an asset from an sc_task (Catalog task form).&lt;BR /&gt;&lt;BR /&gt;I'm using a combination of a GlideModal "glide_prompt", to prompt for the asset tag along with a GlideModalForm to call the alm_hardware form.&amp;nbsp; I can get the initial prompt and a form to load, but not of the specific asset from the prompt.&lt;BR /&gt;&lt;BR /&gt;My code so far is below, but my use case is:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;From sc_task/catalog task form, agent clicks UI action&lt;/LI&gt;&lt;LI&gt;UI Action generates prompt to input asset tag&lt;/LI&gt;&lt;LI&gt;UI Action loads specific asset tag form (alm_hardware)&lt;/LI&gt;&lt;LI&gt;UI action sets state to "in use"&lt;/LI&gt;&lt;LI&gt;UI action sets assigned_to to value of sc_task.request_item.requested_for&lt;/LI&gt;&lt;LI&gt;UI action closes sc_task on submit of GlideModalForm.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Like I said, I can get the initial prompt, the loading of a new asset (not of specific) and I can set the state but can't seem to figure out what I'm missing to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;load the specific asset form&lt;/LI&gt;&lt;LI&gt;get the variable of sc_task.request_item.requested_for&lt;/LI&gt;&lt;LI&gt;close the sc_task on callback.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Here's my code so far:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function scan_hardware(){
var gm = new GlideModal("glide_prompt", true, 600);
gm.setTitle("Scan Hardware");
gm.setPreference("title", "Asset Tag:");
gm.setPreference("onPromptComplete", function(value) {
	if (value!=""){
	var af= new GlideModalForm('Update Asset','alm_asset',''); //no callback yet
	var assetSID = value;
	af.setPreference('install_status',1) //set state to in use
	af.setPreference('asset_tag',assetSID);
	//af.setPreference('sys_id',assetSID);
	af.render();
	}else
	alert("you didn't enter a value!");
});
gm.setPreference("onPromptCancel", function(value) {alert("You clicked on 'Cancel', value was: "+value)});
gm.render();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once I figure this out, my next question will be can you have two input boxes in the "glide_prompt" modal? I'd like to be able to scan for either asset tag or serial number, then use the input box who's value isn't =''&lt;BR /&gt;&lt;BR /&gt;Thanks everyone!&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 14:11:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100083#M1598</guid>
      <dc:creator>JGerrity</dc:creator>
      <dc:date>2024-11-08T14:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: UI Action GlideModelForm passing values and callback</title>
      <link>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100151#M1599</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/728179"&gt;@JGerrity&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check below thread, here i had gen working code. You&amp;nbsp; just need to do little modification on it.&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.servicenow.com/community/virtual-agent-forum/ui-action-to-assign-incidents-to-problem/m-p/3099108#M12597" target="_blank"&gt;https://www.servicenow.com/community/virtual-agent-forum/ui-action-to-assign-incidents-to-problem/m-p/3099108#M12597&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Runjay Patel - ServiceNow Solution Architect&lt;BR /&gt;YouTube: &lt;A href="https://www.youtube.com/@RunjayP" target="_blank"&gt;https://www.youtube.com/@RunjayP&lt;/A&gt;&lt;BR /&gt;LinkedIn: &lt;A href="https://www.linkedin.com/in/runjay" target="_blank"&gt;https://www.linkedin.com/in/runjay&lt;/A&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 15:32:11 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100151#M1599</guid>
      <dc:creator>Runjay Patel</dc:creator>
      <dc:date>2024-11-08T15:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: UI Action GlideModelForm passing values and callback</title>
      <link>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100154#M1600</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/100741"&gt;@Runjay Patel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for the quick response, after reviewing your post I'm not sure it's what I'm looking for.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You're using UI Pages with script includes.&amp;nbsp; &amp;nbsp;I was hoping to contain everything within the UI Action client script.&lt;BR /&gt;Do you know how to reference a specific asset form view within glidmodalform?&amp;nbsp; I'm prompting for the asset_tag and want to show the form of that specific asset.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;J.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Nov 2024 15:36:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/ui-action-glidemodelform-passing-values-and-callback/m-p/3100154#M1600</guid>
      <dc:creator>JGerrity</dc:creator>
      <dc:date>2024-11-08T15:36:55Z</dc:date>
    </item>
  </channel>
</rss>

