<?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: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do? in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967015#M623941</link>
    <description>&lt;P&gt;I also can't understand that g_form.getControl('applicantdept')&amp;amp;g_form.getValue('variables.approver') don't return true&amp;amp;false why it can be written as below?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;function onLoad(){&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; var applicantdept_element = g_form.getControl('applicantdept');&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt; if(!applicantdept_element){&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;***************************&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; var approver_name = g_form.getValue('variables.approver');&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; if(!approver_name){&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;******************&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 13 Feb 2018 05:02:00 GMT</pubDate>
    <dc:creator>chenyanwei</dc:creator>
    <dc:date>2018-02-13T05:02:00Z</dc:date>
    <item>
      <title>what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967012#M623938</link>
      <description>&lt;P&gt;the fieldname are both reference type in catalog item .&lt;/P&gt;&lt;P&gt;g_form.getControl('fieldname') returned a:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="ã‚­ãƒ£ãƒ—ãƒ�ãƒ£.PNG"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/62101iD97F6F4D236DD1D0/image-size/large?v=v2&amp;amp;px=999" role="button" title="ã‚­ãƒ£ãƒ—ãƒ�ãƒ£.PNG" alt="ã‚­ãƒ£ãƒ—ãƒ�ãƒ£.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;what dose this mean? and what does it can do?&lt;/P&gt;&lt;P&gt;and &amp;nbsp; g_form.getValue(variables.fieldname) did not return anything when I alert it, why not just use g_form.getValue('fieldname')?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 02:45:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967012#M623938</guid>
      <dc:creator>chenyanwei</dc:creator>
      <dc:date>2018-02-13T02:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967013#M623939</link>
      <description>&lt;P&gt;can you try g_form.getDisplayBox('variable_name').value&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 02:53:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967013#M623939</guid>
      <dc:creator>Prateek kumar</dc:creator>
      <dc:date>2018-02-13T02:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967014#M623940</link>
      <description>&lt;P&gt;Hello Chen,&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;g_form.getControl() function Returns the HTML element for the specified field, so that you can perform the html related operation on that field like setting the maximum length, background color on the field etc. Example, if you want to set the length of the short_description field to 80. &lt;A href="https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html" style="font-family: arial, sans-serif;" title="https://docs.servicenow.com/bundle/kingston-application-development/page/app-store/dev_portal/API_reference/GlideForm/concept/c_GlideFormAPI.html"&gt;GlideForm - Client&lt;/A&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;functiononLoad(){&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;var sd = g_form.getControl('short_description');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;sd.maxLength=80;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;}&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;you can use the &lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;g_form.getValue('fieldname') but here it should be variable_name. You should be able to get the value using &lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;variable_name&lt;/SPAN&gt;. One consideration as per the documentation: &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;SPAN style="color: #666666; font-family: arial, sans-serif;"&gt;&lt;A href="https://docs.servicenow.com/bundle/kingston-application-development/page/script/client-scripts/concept/c_CatalogClientScriptCreation.html" title="https://docs.servicenow.com/bundle/kingston-application-development/page/script/client-scripts/concept/c_CatalogClientScriptCreation.html"&gt;Catalog client script creation&lt;/A&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;When using standard client scripts on a Requested Item or Catalog Task form, make a note of fields with the same name as variables. If a table field and a variable of the same name are both present on a form, the table field is matched when it is accessed using a script. If this happens, specifically address the variable by naming it variables.variable name. For example: g_form.setValue('variables.replacement', 'false');&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;Please let us know what script are you using which is not working as expected?&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 03:18:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967014#M623940</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2018-02-13T03:18:58Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967015#M623941</link>
      <description>&lt;P&gt;I also can't understand that g_form.getControl('applicantdept')&amp;amp;g_form.getValue('variables.approver') don't return true&amp;amp;false why it can be written as below?&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;function onLoad(){&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; var applicantdept_element = g_form.getControl('applicantdept');&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt; if(!applicantdept_element){&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;***************************&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt; }&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; var approver_name = g_form.getValue('variables.approver');&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; if(!approver_name){&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;******************&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 05:02:00 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967015#M623941</guid>
      <dc:creator>chenyanwei</dc:creator>
      <dc:date>2018-02-13T05:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967016#M623942</link>
      <description>&lt;P&gt;I believe, this is because they return value instead of Boolean value, if they could have returned yes /no OR true/false then we could have used those in if condition to check their existence for further proceeding.&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 05:06:48 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967016#M623942</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2018-02-13T05:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967017#M623943</link>
      <description>&lt;P&gt;Chen - if getcontrol gives you the html output and getValue gives you field value then if you assign these to some variable then how will you get Boolean as output .&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;So as rules of law states what is assigned is what you get. &lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 05:21:56 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967017#M623943</guid>
      <dc:creator>Kunal Jha</dc:creator>
      <dc:date>2018-02-13T05:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: what g_form.getControl('fieldname')&amp;g_form.getValue(variables.fieldname) can do?</title>
      <link>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967018#M623944</link>
      <description>&lt;P&gt;instead you can try like, for &lt;STRONG&gt;example&lt;/STRONG&gt;:&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&lt;EM style="color: #666666; font-family: inherit; font-weight: inherit;"&gt;if(approver_name != null || &lt;EM style="color: #666666; font-family: inherit; font-weight: inherit;"&gt;approver_name != ''&lt;/EM&gt;)&lt;/EM&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 13 Feb 2018 05:24:20 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/what-g-form-getcontrol-fieldname-g-form-getvalue-variables/m-p/1967018#M623944</guid>
      <dc:creator>Shishir Srivast</dc:creator>
      <dc:date>2018-02-13T05:24:20Z</dc:date>
    </item>
  </channel>
</rss>

