<?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: Creating FIX Script which can be re-used for different values in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/3009738#M1135766</link>
    <description>&lt;P&gt;It's inspiring to see that things like this still hold true.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2024 17:40:50 GMT</pubDate>
    <dc:creator>Goran WitchDoc</dc:creator>
    <dc:date>2024-08-05T17:40:50Z</dc:date>
    <item>
      <title>Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989020#M645946</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have created a fix script to modify fields in the Incident table.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In some cases we need to add values after creation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Managed to create the fix script, but the values i need to supply to the Incident table contain a different INC id everytime i run the script.&amp;nbsp;&lt;BR /&gt;Is there a way to make the script 're-usable' ... that is... Current when i use a new ID to search for and supply the values, i need to save the FIX Script, which results in a new version .. We will end up with a lot of versions this way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fix script looks like this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(number and u_external_relation_id will both have different values everytime i need to run the script)&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;updateIncident();&lt;/P&gt;
&lt;P&gt;function updateIncident(){&lt;BR /&gt;try{&lt;BR /&gt;gs.info('Fix Script started for updateIncidentID');&lt;BR /&gt;var inc = new GlideRecord('incident');&lt;BR /&gt;inc.addQuery('number=INC0014924');&lt;/P&gt;
&lt;P&gt;//inc.setLimit(10); &lt;BR /&gt;inc.query();&lt;BR /&gt;if(inc.next()){&lt;BR /&gt; &lt;BR /&gt;inc.u_external_relation_id = 'INM000000452354'; &lt;BR /&gt;&lt;BR /&gt; inc.setWorkflow(false);&amp;nbsp;&lt;BR /&gt; inc.update();&lt;BR /&gt;}&lt;BR /&gt;gs.info('Fix Script Ended for updateIncidentID');&lt;/P&gt;
&lt;P&gt;}&lt;BR /&gt;catch(ex){&lt;BR /&gt;gs.info('Exception is: ' + ex);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:28:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989020#M645946</guid>
      <dc:creator>HT</dc:creator>
      <dc:date>2020-01-10T10:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989021#M645947</link>
      <description>&lt;P&gt;You can create a system property and use it in your fix script. This way you would just need to update the property everytime before running the fix script.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:35:13 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989021#M645947</guid>
      <dc:creator>Kalaiarasan Pus</dc:creator>
      <dc:date>2020-01-10T10:35:13Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989022#M645948</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You could easily just have it as a function in a script include and call it from scripts - Background. Script include could look something like this:&lt;/P&gt;
&lt;P&gt;&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/56690iF12EEEA5485D0F9F/image-size/large?v=v2&amp;amp;px=999" srcset="/community/image/serverpage/image-id/56690iF12EEEA5485D0F9F/image-size/large?v=v2&amp;amp;px=999 1.0x, /community/image/serverpage/image-id/56690iF12EEEA5485D0F9F/image-dimensions/1998x1329?v=v2 2.0x" role="button" title="find_real_file.png" alt="find_real_file.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;And then in the scripts - Background you just call it like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;new incUtils().updateExtRel('INC0014924','INM000000452354')&lt;/P&gt;
&lt;P&gt;//Göran&lt;BR /&gt;Feel free to connect:&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/goranlundqvist/" rel="nofollow"&gt;&lt;U&gt;LinkedIn&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;Subscribe to my &lt;A href="https://www.youtube.com/channel/UCUJK90r6dnu-YXHyDOVIRww" rel="nofollow"&gt;&lt;U&gt;YouTube Channel&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;or look at my Book: &lt;A href="https://www.amazon.com/dp/179462631X" rel="nofollow"&gt;&lt;U&gt;The Witch Doctor’s Guide To ServiceNow&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:36:27 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989022#M645948</guid>
      <dc:creator>Goran WitchDoc</dc:creator>
      <dc:date>2020-01-10T10:36:27Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989023#M645949</link>
      <description>&lt;P&gt;Just remember updating a system property will flush the whole cache each time you update it &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;//Göran&lt;BR /&gt;Feel free to connect:&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/goranlundqvist/" rel="nofollow"&gt;&lt;U&gt;LinkedIn&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;Subscribe to my &lt;A href="https://www.youtube.com/channel/UCUJK90r6dnu-YXHyDOVIRww" rel="nofollow"&gt;&lt;U&gt;YouTube Channel&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;or look at my Book: &lt;A href="https://www.amazon.com/dp/179462631X" rel="nofollow"&gt;&lt;U&gt;The Witch Doctor’s Guide To ServiceNow&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:37:03 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989023#M645949</guid>
      <dc:creator>Goran WitchDoc</dc:creator>
      <dc:date>2020-01-10T10:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989024#M645950</link>
      <description>&lt;P&gt;There are pitfalls in every approach but yes the script include approach is better in terms of reusability.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:39:49 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989024#M645950</guid>
      <dc:creator>Kalaiarasan Pus</dc:creator>
      <dc:date>2020-01-10T10:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989025#M645951</link>
      <description>&lt;P&gt;absolutely, just wanted to mention it since many people don't know about the cache flush when you change values &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;//Göran&lt;BR /&gt;Feel free to connect:&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/goranlundqvist/" rel="nofollow"&gt;&lt;U&gt;LinkedIn&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;Subscribe to my &lt;A href="https://www.youtube.com/channel/UCUJK90r6dnu-YXHyDOVIRww" rel="nofollow"&gt;&lt;U&gt;YouTube Channel&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;or look at my Book: &lt;A href="https://www.amazon.com/dp/179462631X" rel="nofollow"&gt;&lt;U&gt;The Witch Doctor’s Guide To ServiceNow&lt;/U&gt;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jan 2020 10:44:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989025#M645951</guid>
      <dc:creator>Goran WitchDoc</dc:creator>
      <dc:date>2020-01-10T10:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989026#M645952</link>
      <description>&lt;P&gt;Great,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;didn't think about using a function for this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jan 2020 20:39:30 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/1989026#M645952</guid>
      <dc:creator>HT</dc:creator>
      <dc:date>2020-01-16T20:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/3009435#M1135692</link>
      <description>&lt;P&gt;I did not know this and as I have some junior developers on the team whom I've seen do this for various use cases I am happy to know this now! Thank you Goran!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 13:22:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/3009435#M1135692</guid>
      <dc:creator>apjohn2</dc:creator>
      <dc:date>2024-08-05T13:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating FIX Script which can be re-used for different values</title>
      <link>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/3009738#M1135766</link>
      <description>&lt;P&gt;It's inspiring to see that things like this still hold true.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face:"&gt;😀&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2024 17:40:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/creating-fix-script-which-can-be-re-used-for-different-values/m-p/3009738#M1135766</guid>
      <dc:creator>Goran WitchDoc</dc:creator>
      <dc:date>2024-08-05T17:40:50Z</dc:date>
    </item>
  </channel>
</rss>

