<?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 Re: Can i add a button into a catalog item, on the form itself in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531845#M188771</link>
    <description>&lt;P&gt;How about a UI macro on a string field?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1. Add a string field to the form.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2. Add the following onLoad script:&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15106831736281401 jive_text_macro" data-renderedposition="91.6335220336914_7.997159004211426_1192_417" jivemacro_uid="_15106831736281401"&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; //The variable name to put the icon next to&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setReadOnly('available', true);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var varName = 'available';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; try{&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add the icon decoration to the reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var varEl = g_form.getControl(varName).id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(varEl).insert({&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; after: '&amp;lt;span&amp;gt;&amp;lt;a id="icon-check-circle" class="btn btn-default sc-ref-spacer icon-check-circle sn-tooltip-basic" title="" data-original-title="Check availability"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;'&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add the 'onclick' event&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $('icon-check-circle').observe('click', checkAvailability);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }catch(e){}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; function checkAvailability(){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add current user to reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var check = new GlideRecord('u_new_test_table');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.addQuery('u_num', &amp;nbsp; '1');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(check.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is available.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is not available. Bummer.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;Notes&lt;/EM&gt;:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1. icon-check-circle is the name of the icon. You can insert your own or go to Collaborate -&amp;gt; Administration -&amp;gt; Action icons and choose your own&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2. The script is a modification of &lt;A title="mark.stanger" __default_attr="2094" __jive_macro_name="user" class="jive-link-profile-small jive_macro jive_macro_user" data-id="2094" data-objecttype="3" data-orig-content="mark.stanger" data-renderedposition="574.3607788085938_208.7357940673828_99_15" data-type="person" href="https://www.servicenow.com/community?id=community_user_profile&amp;amp;user=eb409229db581fc09c9ffb651f9619d4"&gt;mark.stanger&lt;/A&gt; 's &lt;A title="tps//www.servicenowguru.com/system-ui/ui-macros/add-me-ui-macro-user-group-fields/" href="http://https//www.servicenowguru.com/system-ui/ui-macros/add-me-ui-macro-user-group-fields/"&gt;'Add Me' UI macro for User and Group Fields&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;3. The whole checkAvailability function: replace it with your own code, using the relevant tables and items. In my example, I wanted to check whether the number '1' appears in a field called u_num.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Harel&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 14 Nov 2017 18:13:05 GMT</pubDate>
    <dc:creator>oharel</dc:creator>
    <dc:date>2017-11-14T18:13:05Z</dc:date>
    <item>
      <title>Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531843#M188769</link>
      <description>&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;I want to add a 'check availability' button onto to a catalog item form, before submit, so users can check if we have an item for example&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt;"&gt;Is there a way to do this, using a yes/no is a bit ugly but having a choice button that could trigger it would be quite nice&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 16:01:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531843#M188769</guid>
      <dc:creator>dave_edgar</dc:creator>
      <dc:date>2017-11-14T16:01:02Z</dc:date>
    </item>
    <item>
      <title>Re: Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531844#M188770</link>
      <description>&lt;P&gt;Hi Dave,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;To double check I understand which part of submit you mean:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1.A submit button on service portal catalog item form - unless you use a record producer? It's possible either way using macro/uipage or changing your widget.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2.If it's a form on sc_cat_item table then you can add a UI Action to perform that check.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Greg&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Nov 2017 16:16:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531844#M188770</guid>
      <dc:creator>Greg42</dc:creator>
      <dc:date>2017-11-14T16:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531845#M188771</link>
      <description>&lt;P&gt;How about a UI macro on a string field?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Like this:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1. Add a string field to the form.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2. Add the following onLoad script:&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15106831736281401 jive_text_macro" data-renderedposition="91.6335220336914_7.997159004211426_1192_417" jivemacro_uid="_15106831736281401"&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; //The variable name to put the icon next to&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; g_form.setReadOnly('available', true);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var varName = 'available';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; try{&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add the icon decoration to the reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var varEl = g_form.getControl(varName).id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $(varEl).insert({&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; after: '&amp;lt;span&amp;gt;&amp;lt;a id="icon-check-circle" class="btn btn-default sc-ref-spacer icon-check-circle sn-tooltip-basic" title="" data-original-title="Check availability"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;'&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add the 'onclick' event&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; $('icon-check-circle').observe('click', checkAvailability);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }catch(e){}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; function checkAvailability(){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Add current user to reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var check = new GlideRecord('u_new_test_table');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.addQuery('u_num', &amp;nbsp; '1');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(check.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is available.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is not available. Bummer.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;Notes&lt;/EM&gt;:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1. icon-check-circle is the name of the icon. You can insert your own or go to Collaborate -&amp;gt; Administration -&amp;gt; Action icons and choose your own&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2. The script is a modification of &lt;A title="mark.stanger" __default_attr="2094" __jive_macro_name="user" class="jive-link-profile-small jive_macro jive_macro_user" data-id="2094" data-objecttype="3" data-orig-content="mark.stanger" data-renderedposition="574.3607788085938_208.7357940673828_99_15" data-type="person" href="https://www.servicenow.com/community?id=community_user_profile&amp;amp;user=eb409229db581fc09c9ffb651f9619d4"&gt;mark.stanger&lt;/A&gt; 's &lt;A title="tps//www.servicenowguru.com/system-ui/ui-macros/add-me-ui-macro-user-group-fields/" href="http://https//www.servicenowguru.com/system-ui/ui-macros/add-me-ui-macro-user-group-fields/"&gt;'Add Me' UI macro for User and Group Fields&lt;/A&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;3. The whole checkAvailability function: replace it with your own code, using the relevant tables and items. In my example, I wanted to check whether the number '1' appears in a field called u_num.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Harel&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Nov 2017 18:13:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531845#M188771</guid>
      <dc:creator>oharel</dc:creator>
      <dc:date>2017-11-14T18:13:05Z</dc:date>
    </item>
    <item>
      <title>Re: Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531846#M188772</link>
      <description>&lt;P&gt;arghhhhhh&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;It works perfectly on the normal view but the search button doesn't show in the portal &lt;SPAN __jive_emoticon_name="devil" __jive_macro_name="emoticon" class="jive_macro_emoticon jive_emote jive_macro" data-renderedposition="50_546.578125_16_16" src="https://www.servicenow.com/8.0.4.21bdc7e/images/emoticons/devil.png"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;catalog&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screen Shot 2017-11-15 at 12.53.05.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/168206i26F723E44CD25BAD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-15 at 12.53.05.png" alt="Screen Shot 2017-11-15 at 12.53.05.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;portal&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Screen Shot 2017-11-15 at 12.53.57.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/168218i6C70CAADD4550110/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2017-11-15 at 12.53.57.png" alt="Screen Shot 2017-11-15 at 12.53.57.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Nov 2017 14:07:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531846#M188772</guid>
      <dc:creator>dave_edgar</dc:creator>
      <dc:date>2017-11-15T14:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531847#M188773</link>
      <description>&lt;P&gt;You will need to add a widget to your item in service portal.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;As my knowledge is next to nothing in Angular, this is what I came up with in the meantime. If it does not answer your needs, I suggest to open another discussion in the community (and let me know, so I can follow it &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_emote jive_macro" data-renderedposition="49.815338134765625_174.50283813476562_16_16" src="https://www.servicenow.com/8.0.4.21bdc7e/images/emoticons/happy.png"&gt;&lt;/SPAN&gt; ).&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Anyway, this is what I can offer in the meantime:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;1. Under Service Portal -&amp;gt; Widgets, create the following widget:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Name: availability&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;ID: availability&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Server script:&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_15107670388414761 jive_text_macro" data-renderedposition="176.17897033691406_7.997159004211426_1176_201" jivemacro_uid="_15107670388414761" modifiedtitle="true"&gt;&lt;P&gt;(function() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;/* populate the 'data' object */&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;/* e.g., data.table = $sp.getValue('table'); */&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var check = new GlideRecord('u_new_test_table'); //change this to your table&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.addQuery('u_num', &amp;nbsp; '2'); //change this to your query&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(check.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.addInfoMessage('This item is &amp;nbsp; available');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;gs.addErrorMessage('The item is not available. Go away.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;})();&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;2. add another variable in your item catalog.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;type: single line text&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;order: give it a high number, so it is at the bottom of the page&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;name: widget&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;question: widget&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Under default value: widget: availability (if the field is not there, go to the UI policies of the page and tweak "&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;Widget Reference Visibility". I had to do that on Helsinki)&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;3. change your catalog client script. I added lines 3-10:&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_15107670299382619" data-renderedposition="561.6334838867188_7.997159004211426_1176_618" jivemacro_uid="_15107670299382619" modifiedtitle="true"&gt;&lt;P&gt;function onLoad() {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//lines 3-10&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if (window === null) { //this is what happens on the Service Portal or mobile. You can add more command, like make fields read only.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setVisible('available', false);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setVisible('widget', false);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;} &amp;nbsp; else {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;// Write your desktop compatible code here&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setReadOnly('available', true);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setVisible('widget', false); //this hides the single line text field. You don't need it anyway in the catalog item.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//up to here&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var varName = 'available';&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;try{&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//Add the icon decoration to the reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//If not reference variable, remove 'lookup.' below&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//var varEl = 'lookup.' + g_form.getControl(varName).id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var varEl = g_form.getControl(varName).id;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;$(varEl).insert({&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;after: '&amp;lt;span&amp;gt;&amp;lt;a id="icon-check-circle" class="btn btn-default sc-ref-spacer icon-check-circle sn-tooltip-basic" title="" data-original-title="Check availability"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;'&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;});&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//Add the 'onclick' event&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;$('icon-check-circle').observe('click', checkAvailability);&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}catch(e){}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;function checkAvailability(){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;//Add current user to reference field&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var check = new GlideRecord('u_new_test_table');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.addQuery('u_num', &amp;nbsp; '1');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;check.query();&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if(check.next()) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is available.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;} else {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.setValue(varName, 'The item is not available. Bummer.');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;In service portal, go to your item. If the item is in stock, you should see a message that it is available. If it is not, you will see a different message.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;Sorry - I am not too proficient with widgets, so that's the best I could come up with for now.&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px;"&gt;harel&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 15 Nov 2017 17:33:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531847#M188773</guid>
      <dc:creator>oharel</dc:creator>
      <dc:date>2017-11-15T17:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can i add a button into a catalog item, on the form itself</title>
      <link>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531848#M188774</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have similar requirement in that once we click on button the Date type fields(variable) are coming(highlighted) on the screen(ui page)?&lt;/P&gt;
&lt;P&gt;may i know what is issue&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="find_real_file.png"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/168210i6C8F56127FC3A2B2/image-size/large?v=v2&amp;amp;px=999" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 12:28:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/can-i-add-a-button-into-a-catalog-item-on-the-form-itself/m-p/1531848#M188774</guid>
      <dc:creator>Community Alums</dc:creator>
      <dc:date>2019-07-10T12:28:04Z</dc:date>
    </item>
  </channel>
</rss>

