<?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: How to set default value for a reference field on Catalog Item in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575546#M232472</link>
    <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="19525629dbd81fc09c9ffb651f961989"&gt;@Ankur Bawiskar&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes you are right.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jul 2020 12:57:58 GMT</pubDate>
    <dc:creator>depa</dc:creator>
    <dc:date>2020-07-09T12:57:58Z</dc:date>
    <item>
      <title>How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575538#M232464</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;i have a reference field service and it has always one record. My question is how can i preselect this value so as a default value on the portal? That i dont need to select it always?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Update: Its not a static value.&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/186738iF1B415C86215FF90/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;
&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:32:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575538#M232464</guid>
      <dc:creator>depa</dc:creator>
      <dc:date>2020-07-09T12:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575539#M232465</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Open that reference variable and set default value there.&lt;/P&gt;
&lt;P&gt;Check attached screenshot.&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/186740i32C8C91E004D06AE/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;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Dhananjay.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:37:15 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575539#M232465</guid>
      <dc:creator>Dhananjay Pawar</dc:creator>
      <dc:date>2020-07-09T12:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575540#M232466</link>
      <description>&lt;P&gt;There should be a Default tab on the variable, you should be able to place the sys_id in that tab for it to find the correct record if you're always defaulting to a static value, if that value changes you can call a script include in that field by using something like javascript: [YOUR SCRIPT INCLUDE HERE]&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:38:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575540#M232466</guid>
      <dc:creator>Ashley Snyder1</dc:creator>
      <dc:date>2020-07-09T12:38:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575541#M232467</link>
      <description>&lt;P&gt;Thanks for reply, this is not a static value.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:44:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575541#M232467</guid>
      <dc:creator>depa</dc:creator>
      <dc:date>2020-07-09T12:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575542#M232468</link>
      <description>&lt;P&gt;Thanks for your reply, this is not a static value. Thats why i asked iam new and dunno the code to preselect the record.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:45:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575542#M232468</guid>
      <dc:creator>depa</dc:creator>
      <dc:date>2020-07-09T12:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575543#M232469</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;Based on your reply to others...I'm a bit confused.&lt;/P&gt;
&lt;P&gt;You are saying this is not a static value, correct? Then what is the filter condition on this reference field to result in only one value showing, dynamically? Which is what sounds like is going on here.&lt;/P&gt;
&lt;P&gt;We can't really give you much more help or a script (because you're new...) without more information as to how this field is being dynamically set anyway. Because however it's being set, you really could just use that same logic/script (if applicable) to set the default value instead of just only filtering it to one result. You could do both.&lt;/P&gt;
&lt;P&gt;So let's start there...?&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;Please mark reply as Helpful/Correct, if applicable. Thanks!&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:49:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575543#M232469</guid>
      <dc:creator>Allen Andreas</dc:creator>
      <dc:date>2020-07-09T12:49:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575544#M232470</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;If not static then what value you want to set there.&lt;/P&gt;
&lt;P&gt;What is your business requirement?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:52:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575544#M232470</guid>
      <dc:creator>Dhananjay Pawar</dc:creator>
      <dc:date>2020-07-09T12:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575545#M232471</link>
      <description>&lt;P&gt;Hi Depa,&lt;/P&gt;
&lt;P&gt;Are you saying the table being referred has only 1 value always &amp;amp; you want that to be auto populated?&lt;/P&gt;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:53:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575545#M232471</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-07-09T12:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575546#M232472</link>
      <description>&lt;P&gt;&lt;SN-MENTION class="sn-mention" table="live_profile" sysid="19525629dbd81fc09c9ffb651f961989"&gt;@Ankur Bawiskar&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;yes you are right.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 12:57:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575546#M232472</guid>
      <dc:creator>depa</dc:creator>
      <dc:date>2020-07-09T12:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575547#M232473</link>
      <description>&lt;P&gt;Hi Depa,&lt;/P&gt;
&lt;P&gt;use this then in the default value section&lt;/P&gt;
&lt;P&gt;Note: I assume there is only 1 record in that table&lt;/P&gt;
&lt;P&gt;Give your table name in the query of GlideRecord&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;javascript: getValue(); function getValue(){var gr = new GlideRecord('your_table_name'); gr.query(); if(gr.next()){return gr.sys_id;}}&lt;/CODE&gt;&lt;/PRE&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/186737i01321BFF7EFF4B3E/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;
&lt;P&gt;Regards&lt;BR /&gt;Ankur&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jul 2020 13:05:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575547#M232473</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2020-07-09T13:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575548#M232474</link>
      <description>&lt;P&gt;I tried that approach: the sys_id never populates in my reference variable...&lt;/P&gt;</description>
      <pubDate>Tue, 20 Oct 2020 15:38:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575548#M232474</guid>
      <dc:creator>Randall Arnold</dc:creator>
      <dc:date>2020-10-20T15:38:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575549#M232475</link>
      <description>&lt;P&gt;How to get logged in user detail?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 02:56:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575549#M232475</guid>
      <dc:creator>TT3</dc:creator>
      <dc:date>2021-04-09T02:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575550#M232476</link>
      <description>&lt;P&gt;Hi @TT&lt;/P&gt;
&lt;P&gt;write this script to get loggedin user details:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;javascript:gs.getUserID();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 03:37:44 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575550#M232476</guid>
      <dc:creator>Murthy Ch</dc:creator>
      <dc:date>2021-04-09T03:37:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575551#M232477</link>
      <description>&lt;P&gt;Hello &lt;SN-MENTION class="sn-mention" table="live_profile" sysid="19525629dbd81fc09c9ffb651f961989"&gt;@Ankur Bawiskar&lt;/SN-MENTION&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is exactly what I need aswell, however I get the 'invalid function definition' error.&lt;/P&gt;
&lt;P&gt;Do you have any idea what this could be?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm on Rome by the way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2022 11:12:32 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/1575551#M232477</guid>
      <dc:creator>Lucas3594</dc:creator>
      <dc:date>2022-07-08T11:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value for a reference field on Catalog Item</title>
      <link>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/3161726#M1175203</link>
      <description>&lt;P&gt;This is exactly what I was looking for... if a sys_id could be used... and it worked very well for me. You don't need quotes surrounding sys_id either.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 20:04:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/how-to-set-default-value-for-a-reference-field-on-catalog-item/m-p/3161726#M1175203</guid>
      <dc:creator>AJ2025</dc:creator>
      <dc:date>2025-01-28T20:04:41Z</dc:date>
    </item>
  </channel>
</rss>

