<?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 Coding suggestion on my below code. I was stuck at this point in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/coding-suggestion-on-my-below-code-i-was-stuck-at-this-point/m-p/3034193#M780</link>
    <description>&lt;UL&gt;&lt;LI&gt;In the below code an I use sysid of the entity type market units directly in the code for checking the matchings. Is it comes under hard-coded? Will business team accept it or else do I need to get the sysid dynamically by querying the record. Pls suggest.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;OL&gt;&lt;LI&gt;var AllocationProfileValidationHelper = Class.create();&lt;BR /&gt;AllocationProfileValidationHelper.prototype = {&lt;BR /&gt;initialize: function() {},&lt;BR /&gt;&lt;BR /&gt;validateAllocationProfile: function(current) {&lt;BR /&gt;var workplaceEntity = new GlideRecord('sn_wsd_core_workplace_entity');&lt;BR /&gt;&lt;BR /&gt;// Check if the workplace entity record exists&lt;BR /&gt;if (!workplaceEntity.get(current.workplace_entity)) {&lt;BR /&gt;gs.addErrorMessage("Invalid Workplace Entity.");&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;var entityType = workplaceEntity.entity_type.toLowerCase();&lt;BR /&gt;var allocationProfile = current.allocation_profile.toLowerCase();&lt;BR /&gt;var isValid = true; // Assume validation is successful&lt;BR /&gt;&lt;BR /&gt;// Debugging information&lt;BR /&gt;gs.info("Validation Check: Allocation Profile = " + allocationProfile + ", Entity Type = " + entityType);&lt;BR /&gt;&lt;BR /&gt;if (allocationProfile === 'owner') {&lt;BR /&gt;// For 'Owner' profile, the workplace entity must be of type 'Market Unit'&lt;BR /&gt;if (entityType !== 'fcffa877976e7554bf05b4221153af3b') {&lt;BR /&gt;gs.addErrorMessage("Workplace Entity must be of type 'Market Unit' for 'Owner' profile.");&lt;BR /&gt;gs.info("find if");&lt;BR /&gt;isValid = false;&lt;BR /&gt;}&lt;BR /&gt;} else if (allocationProfile === 'tenant') {&lt;BR /&gt;// For 'Tenant' profile, the workplace entity must NOT be of type 'Market Unit'&lt;BR /&gt;if (entityType === 'fcffa877976e7554bf05b4221153af3b') {&lt;BR /&gt;gs.addErrorMessage("Workplace Entity of type 'Market Unit' cannot be selected for 'Tenant' profile.");&lt;BR /&gt;isValid = false;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Return the validation result&lt;BR /&gt;return isValid;&lt;BR /&gt;}&lt;BR /&gt;};&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 02 Sep 2024 20:41:02 GMT</pubDate>
    <dc:creator>Priyanka21</dc:creator>
    <dc:date>2024-09-02T20:41:02Z</dc:date>
    <item>
      <title>Coding suggestion on my below code. I was stuck at this point</title>
      <link>https://www.servicenow.com/community/community-central-forum/coding-suggestion-on-my-below-code-i-was-stuck-at-this-point/m-p/3034193#M780</link>
      <description>&lt;UL&gt;&lt;LI&gt;In the below code an I use sysid of the entity type market units directly in the code for checking the matchings. Is it comes under hard-coded? Will business team accept it or else do I need to get the sysid dynamically by querying the record. Pls suggest.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;OL&gt;&lt;LI&gt;var AllocationProfileValidationHelper = Class.create();&lt;BR /&gt;AllocationProfileValidationHelper.prototype = {&lt;BR /&gt;initialize: function() {},&lt;BR /&gt;&lt;BR /&gt;validateAllocationProfile: function(current) {&lt;BR /&gt;var workplaceEntity = new GlideRecord('sn_wsd_core_workplace_entity');&lt;BR /&gt;&lt;BR /&gt;// Check if the workplace entity record exists&lt;BR /&gt;if (!workplaceEntity.get(current.workplace_entity)) {&lt;BR /&gt;gs.addErrorMessage("Invalid Workplace Entity.");&lt;BR /&gt;return false;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;var entityType = workplaceEntity.entity_type.toLowerCase();&lt;BR /&gt;var allocationProfile = current.allocation_profile.toLowerCase();&lt;BR /&gt;var isValid = true; // Assume validation is successful&lt;BR /&gt;&lt;BR /&gt;// Debugging information&lt;BR /&gt;gs.info("Validation Check: Allocation Profile = " + allocationProfile + ", Entity Type = " + entityType);&lt;BR /&gt;&lt;BR /&gt;if (allocationProfile === 'owner') {&lt;BR /&gt;// For 'Owner' profile, the workplace entity must be of type 'Market Unit'&lt;BR /&gt;if (entityType !== 'fcffa877976e7554bf05b4221153af3b') {&lt;BR /&gt;gs.addErrorMessage("Workplace Entity must be of type 'Market Unit' for 'Owner' profile.");&lt;BR /&gt;gs.info("find if");&lt;BR /&gt;isValid = false;&lt;BR /&gt;}&lt;BR /&gt;} else if (allocationProfile === 'tenant') {&lt;BR /&gt;// For 'Tenant' profile, the workplace entity must NOT be of type 'Market Unit'&lt;BR /&gt;if (entityType === 'fcffa877976e7554bf05b4221153af3b') {&lt;BR /&gt;gs.addErrorMessage("Workplace Entity of type 'Market Unit' cannot be selected for 'Tenant' profile.");&lt;BR /&gt;isValid = false;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Return the validation result&lt;BR /&gt;return isValid;&lt;BR /&gt;}&lt;BR /&gt;};&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 02 Sep 2024 20:41:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/coding-suggestion-on-my-below-code-i-was-stuck-at-this-point/m-p/3034193#M780</guid>
      <dc:creator>Priyanka21</dc:creator>
      <dc:date>2024-09-02T20:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Coding suggestion on my below code. I was stuck at this point</title>
      <link>https://www.servicenow.com/community/community-central-forum/coding-suggestion-on-my-below-code-i-was-stuck-at-this-point/m-p/3034200#M781</link>
      <description>&lt;P&gt;Yes, that is hard-coding. Program should not contain data.&lt;/P&gt;
&lt;P&gt;Worst case scenario, move the sys_id into a property.&lt;/P&gt;
&lt;P&gt;Best make user of a decision table that can be edited independently of code and that would describe the conditions for the selection to be valid.&lt;/P&gt;
&lt;P&gt;As for business team accepting this, unless you mean something else to what I understand that to be, they are not qualified to judge the solution.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Sep 2024 21:21:19 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/coding-suggestion-on-my-below-code-i-was-stuck-at-this-point/m-p/3034200#M781</guid>
      <dc:creator>-O-</dc:creator>
      <dc:date>2024-09-02T21:21:19Z</dc:date>
    </item>
  </channel>
</rss>

