<?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: If Statement in Transform Script in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165312#M822238</link>
    <description>&lt;P&gt;Thanks James! I tried again by changing to the sys_id of the LDAP server and it worked now!&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Sun, 11 Jun 2017 06:51:39 GMT</pubDate>
    <dc:creator>martin_kohler</dc:creator>
    <dc:date>2017-06-11T06:51:39Z</dc:date>
    <item>
      <title>If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165304#M822230</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am struggeling with a transform script and I hope you can help me. The situation is that during an LDAP consolidation project two different LDAPs need to be imported into ServiceNow. The only possible coalesce attribute is email, however some accounts from the old LDAP should not be overwritten by the new LDAP import. All records that only exist in the new LDAP should, always be updated. I added a new attribute "LDAP_tempuser" to identify accounts that should be overwritten and I set up the following onBefore script to restrict the update process:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_macro_quote jive_text_macro" data-renderedposition="144_8_1192_83" modifiedtitle="true"&gt;&lt;P&gt;if (action == "update" &amp;amp;&amp;amp; target.ldap_server != "newLDAP" &amp;amp;&amp;amp; target.u_ldap_tempuser == false) {&lt;/P&gt;&lt;P&gt; &amp;nbsp; ignore = true;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My expectation is that:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;If all conditions within the if clause are fulfilled, the record is ignored&lt;/LI&gt;&lt;LI&gt;If any of the conditions within the if clause is not fulfilled, the existing record is updated&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, the transform ignores all records, regardless of the if statement above and I cannot see why. Any ideas?&lt;/P&gt;&lt;P&gt;The attached screenshot shows the intended logical flow if that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 09:47:01 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165304#M822230</guid>
      <dc:creator>martin_kohler</dc:creator>
      <dc:date>2017-06-09T09:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165305#M822231</link>
      <description>&lt;P&gt;Hey Martin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;target.ldap_server is a reference field so "newLDAP" actually needs to be the sys_id of the newLDAP server you have created.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14970038775984866 jive_text_macro" data-renderedposition="92_8_1192_64" jivemacro_uid="_14970038775984866"&gt;&lt;P&gt;var ldap_server = "32424a11dbba22002686da94ce96194b"; // newLDAP&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;if (action == "update" &amp;amp;&amp;amp; target.ldap_server != ldap_server &amp;amp;&amp;amp; target.u_ldap_tempuser == false) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; ignore = true;&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;Right now, nothing is being inserted because that field would never equal "newLDAP".&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;James&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 10:24:51 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165305#M822231</guid>
      <dc:creator>James_Neale</dc:creator>
      <dc:date>2017-06-09T10:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165306#M822232</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;thank you for your reply. Sorry, I should have mentioned that "newLDAP" was just anonymized for the string value of the actual LDAP server name of the new LDAP server. Does it have to be the sys_id or can it also be the string value?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;And even if i take the LDAP server condition out of the if statement and just have&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;PRE __jive_macro_name="quote" class="jive_macro_quote jive_text_macro" data-renderedposition="165_8_793_83"&gt;&lt;P&gt;if (action == "update" &amp;amp;&amp;amp; target.u_ldap_tempuser == false) {&lt;/P&gt;&lt;BR /&gt;&lt;P&gt; &amp;nbsp; ignore = true;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;the records are still ignored instead of updated. So I was wondering if the &amp;amp;&amp;amp; operators within if statements of transform scripts are generally possible.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;I also tried to create the new variable "ldap_server" with the sys_id and include that instead of the string value in the script but still no change. All records are ignored by the onBefore Script.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Thanks and kind regards,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:05:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165306#M822232</guid>
      <dc:creator>martin_kohler</dc:creator>
      <dc:date>2017-06-09T11:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165307#M822233</link>
      <description>&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Have you checked the transform logs, there you will find the reason why it is being ignored.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:15:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165307#M822233</guid>
      <dc:creator>vinothkumar</dc:creator>
      <dc:date>2017-06-09T11:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165308#M822234</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;thank you for your reply. The transform history shows that one record was ignored. In the corresponding log entries in the related list, there is nothing about "ignore". Or am I looking at the wrong place for the log?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Kind regards&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:27:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165308#M822234</guid>
      <dc:creator>martin_kohler</dc:creator>
      <dc:date>2017-06-09T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165309#M822235</link>
      <description>&lt;P&gt;Hello Martin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Navigate to the import set and open the import set that you have recently opened and in the bottom of the form, you will get import set record, there you can check in the comments&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&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/69781i5513ABB8B3C23F54/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;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:35:52 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165309#M822235</guid>
      <dc:creator>vinothkumar</dc:creator>
      <dc:date>2017-06-09T11:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165310#M822236</link>
      <description>&lt;P&gt;Thank you. It says "&lt;SPAN style="color: #343d47; font-family: SourceSansPro, 'Helvetica Neue', Arial; font-size: 13px; background-color: #f5f5f5;"&gt;Row transform ignored by onBefore script". As the onBefore script I posted above is the only onBefore Script, something is wrong there. Any ideas?&lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:43:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165310#M822236</guid>
      <dc:creator>martin_kohler</dc:creator>
      <dc:date>2017-06-09T11:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165311#M822237</link>
      <description>&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Sorry, I don't see any wrong in your before transform map.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;May be both the condition are satisified , so why ignored. To ensure put gs.log for the both the values.&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;if (action == "update" &amp;amp;&amp;amp; target.u_ldap_tempuser == false) {&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt; &amp;nbsp; ignore = true;&lt;/P&gt;&lt;BR /&gt;&lt;P style="font-family: arial, sans-serif; color: #666666;"&gt;}&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Jun 2017 11:58:35 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165311#M822237</guid>
      <dc:creator>vinothkumar</dc:creator>
      <dc:date>2017-06-09T11:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: If Statement in Transform Script</title>
      <link>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165312#M822238</link>
      <description>&lt;P&gt;Thanks James! I tried again by changing to the sys_id of the LDAP server and it worked now!&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Sun, 11 Jun 2017 06:51:39 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/if-statement-in-transform-script/m-p/2165312#M822238</guid>
      <dc:creator>martin_kohler</dc:creator>
      <dc:date>2017-06-11T06:51:39Z</dc:date>
    </item>
  </channel>
</rss>

