<?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 Inegration question about coalesce in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308943#M3578</link>
    <description>&lt;P&gt;I have a requirement Employee data integration from SAP to ServiceNow in a custom Employee Profile table.&lt;/P&gt;&lt;P&gt;SAP has unique field Employee ID.&lt;/P&gt;&lt;P&gt;Employee Profile do not have any such field, whereas it has field "User" which is a reference to User table (sys_user).&lt;/P&gt;&lt;P&gt;User table has Employee ID field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m trying to use the COALESCE function, but I’m running into issues. Could you please help or suggest a better approach, any script or something&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jul 2025 08:35:46 GMT</pubDate>
    <dc:creator>srohan24</dc:creator>
    <dc:date>2025-07-03T08:35:46Z</dc:date>
    <item>
      <title>Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308943#M3578</link>
      <description>&lt;P&gt;I have a requirement Employee data integration from SAP to ServiceNow in a custom Employee Profile table.&lt;/P&gt;&lt;P&gt;SAP has unique field Employee ID.&lt;/P&gt;&lt;P&gt;Employee Profile do not have any such field, whereas it has field "User" which is a reference to User table (sys_user).&lt;/P&gt;&lt;P&gt;User table has Employee ID field.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I’m trying to use the COALESCE function, but I’m running into issues. Could you please help or suggest a better approach, any script or something&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 08:35:46 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308943#M3578</guid>
      <dc:creator>srohan24</dc:creator>
      <dc:date>2025-07-03T08:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308971#M3579</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;how are you loading? are you using transform map etc?&lt;/P&gt;
&lt;P&gt;you can use onBefore transform script and check if that Employee ID is present for any of the user on that table and then allow insert/update&lt;/P&gt;
&lt;P&gt;Don't use field maps here.&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 08:51:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308971#M3579</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-03T08:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308983#M3580</link>
      <description>&lt;P&gt;Yes, I am using transform map and below onBefore script -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(function transformRow(source, target, map, log, isUpdate) {&lt;BR /&gt;&lt;BR /&gt;if (!sapEmpNum) {&lt;BR /&gt;gs.warn('[onBefore] Missing or invalid employee number in source');&lt;BR /&gt;ignore = true;&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var userGr = new GlideRecord('sys_user');&lt;BR /&gt;userGr.addQuery('employee_number', sapEmpNum);&lt;BR /&gt;userGr.query();&lt;/P&gt;&lt;P&gt;if (!userGr.next()) {&lt;BR /&gt;gs.warn('[onBefore] No matching sys_user for employee_number: ' + sapEmpNum);&lt;BR /&gt;ignore = true;&lt;BR /&gt;return;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;var userSysId = userGr.getUniqueValue();&lt;/P&gt;&lt;P&gt;var profileGr = new GlideRecord('sn_employee_profile');&lt;BR /&gt;profileGr.addQuery('user', userSysId);&lt;BR /&gt;profileGr.query();&lt;/P&gt;&lt;P&gt;if (profileGr.next()) {&lt;BR /&gt;target.setValue('sys_id', profileGr.getUniqueValue());&lt;BR /&gt;gs.info('[onBefore] Updating Employee Profile with sys_id: ' + profileGr.getUniqueValue());&lt;BR /&gt;} else {&lt;BR /&gt;gs.warn('[onBefore] No matching sn_employee_profile for user sys_id: ' + userSysId);&lt;BR /&gt;ignore = true;&lt;BR /&gt;}&lt;BR /&gt;})(source, target, map, log, action === 'update');&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 08:59:09 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3308983#M3580</guid>
      <dc:creator>srohan24</dc:creator>
      <dc:date>2025-07-03T08:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309001#M3581</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;so where are you stuck?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:14:37 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309001#M3581</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-03T09:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309002#M3582</link>
      <description>&lt;P&gt;it keeps creating records in the target table, instead of updating&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:17:36 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309002#M3582</guid>
      <dc:creator>srohan24</dc:creator>
      <dc:date>2025-07-03T09:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309004#M3583</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;,&amp;nbsp;&lt;BR /&gt;I saw your transform script that you shared.&lt;BR /&gt;&lt;BR /&gt;Can you please explain more the whole ambition?&lt;BR /&gt;&lt;BR /&gt;The coalesce field works like a validation whether that field in the coalesce fields exists, the record is updated, if it doesn't exist, it creates a new record... there can be more than just one coalesce fields if needed.&lt;BR /&gt;&lt;BR /&gt;You want to track the SAP ID or you want to store it? You can create a custom field on User table and receive that value in that field...&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Or what exactly is the issue?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:19:59 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309004#M3583</guid>
      <dc:creator>GlideFather</dc:creator>
      <dc:date>2025-07-03T09:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309009#M3584</link>
      <description>&lt;P&gt;Hello &lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please verify below points&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there any other business rule/script to create profiles.??&lt;/LI&gt;&lt;LI&gt;also make sure that if record not found on target table ignore the insert action.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;--&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;FONT face="georgia, serif"&gt;Thanks &amp;amp; Regards ,&lt;/FONT&gt;&lt;/DIV&gt;&lt;STRONG&gt;&lt;FONT face="georgia, serif" size="4"&gt;Supriya Waghmode |&lt;/FONT&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&lt;FONT size="4"&gt;ServiceNow Consultant&lt;/FONT&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;A href="http://www.linkedin.com/in/supriya-waghmode" target="_blank" rel="noopener nofollow noreferrer"&gt;www.linkedin.com/in/supriya-waghmode&lt;/A&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:22:23 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309009#M3584</guid>
      <dc:creator>SupriyaWaghmode</dc:creator>
      <dc:date>2025-07-03T09:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309035#M3585</link>
      <description>&lt;UL&gt;&lt;LI&gt;there is a BR to&amp;nbsp;Enforce unique user for Employee Profile&lt;/LI&gt;&lt;LI&gt;below section of onBefore is ignoring the the insert action&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if (profileGr.next()) {&lt;BR /&gt;target.setValue('sys_id', profileGr.getUniqueValue());&lt;BR /&gt;gs.info('[onBefore] Updating Employee Profile with sys_id: ' + profileGr.getUniqueValue());&lt;BR /&gt;} else {&lt;BR /&gt;gs.warn('[onBefore] No matching sn_employee_profile for user sys_id: ' + userSysId);&lt;BR /&gt;ignore = true;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:35:33 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309035#M3585</guid>
      <dc:creator>srohan24</dc:creator>
      <dc:date>2025-07-03T09:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309044#M3586</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where have you written that script?&lt;/P&gt;
&lt;P&gt;is that onBefore transform script?&lt;/P&gt;
&lt;P&gt;I couldn't find the variable defined anywhere&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;sapEmpNum&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also you need to use next() method to actually go to that gliderecord object&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV style="color: #000000; background-color: #fffffe; font-family: Consolas, 'Courier New', monospace; font-weight: normal; font-size: 14px; line-height: 19px; white-space: pre;"&gt;
&lt;DIV&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt; transformRow(source, target, map, log, isUpdate) {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!sapEmpNum) {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.warn(&lt;/SPAN&gt;&lt;SPAN&gt;'[onBefore] Missing or invalid employee number in source'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ignore = &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; userGr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecord&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_user'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; userGr.addQuery(&lt;/SPAN&gt;&lt;SPAN&gt;'employee_number'&lt;/SPAN&gt;&lt;SPAN&gt;, sapEmpNum);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; userGr.query();&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (!userGr.next()) {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.warn(&lt;/SPAN&gt;&lt;SPAN&gt;'[onBefore] No matching sys_user for employee_number: '&lt;/SPAN&gt;&lt;SPAN&gt; + sapEmpNum);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ignore = &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;&lt;STRONG&gt;userGr.next();&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; userSysId = userGr.getUniqueValue();&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;BR /&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; profileGr = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;GlideRecord&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'sn_employee_profile'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; profileGr.addQuery(&lt;/SPAN&gt;&lt;SPAN&gt;'user'&lt;/SPAN&gt;&lt;SPAN&gt;, userSysId);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; profileGr.query();&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;if&lt;/SPAN&gt;&lt;SPAN&gt; (profileGr.next()) {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; target.setValue(&lt;/SPAN&gt;&lt;SPAN&gt;'sys_id'&lt;/SPAN&gt;&lt;SPAN&gt;, profileGr.getUniqueValue());&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.info(&lt;/SPAN&gt;&lt;SPAN&gt;'[onBefore] Updating Employee Profile with sys_id: '&lt;/SPAN&gt;&lt;SPAN&gt; + profileGr.getUniqueValue());&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; } &lt;/SPAN&gt;&lt;SPAN&gt;else&lt;/SPAN&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gs.warn(&lt;/SPAN&gt;&lt;SPAN&gt;'[onBefore] No matching sn_employee_profile for user sys_id: '&lt;/SPAN&gt;&lt;SPAN&gt; + userSysId);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ignore = &lt;/SPAN&gt;&lt;SPAN&gt;true&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; }&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;})(source, target, map, log, action === &lt;/SPAN&gt;&lt;SPAN&gt;'update'&lt;/SPAN&gt;&lt;SPAN&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jul 2025 09:40:24 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3309044#M3586</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-03T09:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: Inegration question about coalesce</title>
      <link>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3310032#M3593</link>
      <description>&lt;P&gt;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/700437"&gt;@srohan24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you are doing good.&lt;/P&gt;
&lt;P&gt;Did my reply answer your question?&lt;/P&gt;
&lt;P&gt;If my response helped please mark it correct and close the thread so that it benefits future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2025 04:39:41 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/inegration-question-about-coalesce/m-p/3310032#M3593</guid>
      <dc:creator>Ankur Bawiskar</dc:creator>
      <dc:date>2025-07-04T04:39:41Z</dc:date>
    </item>
  </channel>
</rss>

