<?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: Issue with  g_form.elements.length in UI Action in ITSM forum</title>
    <link>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522045#M556608</link>
    <description>&lt;P&gt;I'm sorry but I don't understand the purpose of that requirement. If the fields are mandatory, why do you want to override it only on workspace? If you want to allow the users to submit the form, then you might as well set the fields to mandatory false on all views.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Apr 2026 01:11:45 GMT</pubDate>
    <dc:creator>AnirudhKumar</dc:creator>
    <dc:date>2026-04-09T01:11:45Z</dc:date>
    <item>
      <title>Issue with  g_form.elements.length in UI Action</title>
      <link>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522044#M556607</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;g_form.elements.length in workspace client script UI action. I am trying to bypass all mandatory fields and save data. It is working in regular form view, but not in workspace. Can we bypass all required fields in workspace and save form?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 00:48:55 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522044#M556607</guid>
      <dc:creator>pramodkumar</dc:creator>
      <dc:date>2026-04-09T00:48:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with  g_form.elements.length in UI Action</title>
      <link>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522045#M556608</link>
      <description>&lt;P&gt;I'm sorry but I don't understand the purpose of that requirement. If the fields are mandatory, why do you want to override it only on workspace? If you want to allow the users to submit the form, then you might as well set the fields to mandatory false on all views.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 01:11:45 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522045#M556608</guid>
      <dc:creator>AnirudhKumar</dc:creator>
      <dc:date>2026-04-09T01:11:45Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with  g_form.elements.length in UI Action</title>
      <link>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522058#M556609</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/412912"&gt;@pramodkumar&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;g_form.element is deprecated (Refer: &lt;A href="https://www.servicenow.com/docs/r/zurich/api-reference/c_GlideFormAPI.html" target="_self"&gt;GlideForm (g_form) - Client&lt;/A&gt;&amp;nbsp;).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;While it works in the "Core UI" (standard platform), it will fail in Workspace because the underlying DOM structure is different and modern Workspace APIs enforce stricter isolation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Instead of g_form.elements, use &lt;STRONG&gt;g_form.getEditableFields()&lt;/STRONG&gt; to retrieve an array of field names. This method is compatible with Workspace.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Sample code:&amp;nbsp; &amp;lt;write code as per your requirement&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Refer:&amp;nbsp;&lt;A href="https://www.servicenow.com/community/developer-forum/workspace-client-script-ui-action/m-p/2516509/page/2" target="_blank" rel="noopener"&gt;https://www.servicenow.com/community/developer-forum/workspace-client-script-ui-action/m-p/2516509/page/2&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN class=""&gt;function&lt;/SPAN&gt;&lt;SPAN class=""&gt; onClick(g_form) {
    &lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt;&lt;SPAN class=""&gt; fields = g_form.getEditableFields();
    &lt;/SPAN&gt;&lt;SPAN class=""&gt;for&lt;/SPAN&gt;&lt;SPAN class=""&gt; (&lt;/SPAN&gt;&lt;SPAN class=""&gt;var&lt;/SPAN&gt;&lt;SPAN class=""&gt; i = &lt;/SPAN&gt;&lt;SPAN class=""&gt;0&lt;/SPAN&gt;&lt;SPAN class=""&gt;; x &amp;lt; fields.length; i++) {
        g_form.setMandatory(fields[i], &lt;/SPAN&gt;&lt;SPAN class=""&gt;false&lt;/SPAN&gt;&lt;SPAN class=""&gt;);
    }
    g_form.submit();
}&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Apr 2026 02:40:38 GMT</pubDate>
      <guid>https://www.servicenow.com/community/itsm-forum/issue-with-g-form-elements-length-in-ui-action/m-p/3522058#M556609</guid>
      <dc:creator>Tanushree Maiti</dc:creator>
      <dc:date>2026-04-09T02:40:38Z</dc:date>
    </item>
  </channel>
</rss>

