<?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 Client Script not working in Service Operations Workspace in Community Central forum</title>
    <link>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3478953#M5964</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;How do I make this code work in Service Operation Workspace? I am trying to remove the Deny / Accept link&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setReadOnly('state', true);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setReadOnly('sysapproval', true);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setVisible('document_id', false);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;if(g_form.getValue('u_request') == '') {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;var link = document.getElementsByClassName('web');&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;for(var i = 0; i &amp;lt; link.length; i++) {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;link[i].style.visibility = 'hidden';&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JLeong_0-1769827497044.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/498977i3FDC212135693857/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JLeong_0-1769827497044.png" alt="JLeong_0-1769827497044.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Sat, 31 Jan 2026 02:46:04 GMT</pubDate>
    <dc:creator>JLeong</dc:creator>
    <dc:date>2026-01-31T02:46:04Z</dc:date>
    <item>
      <title>Client Script not working in Service Operations Workspace</title>
      <link>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3478953#M5964</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;How do I make this code work in Service Operation Workspace? I am trying to remove the Deny / Accept link&lt;/P&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setReadOnly('state', true);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setReadOnly('sysapproval', true);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;g_form.setVisible('document_id', false);&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;if(g_form.getValue('u_request') == '') {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;var link = document.getElementsByClassName('web');&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;for(var i = 0; i &amp;lt; link.length; i++) {&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;link[i].style.visibility = 'hidden';&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JLeong_0-1769827497044.png" style="width: 400px;"&gt;&lt;img src="https://www.servicenow.com/community/image/serverpage/image-id/498977i3FDC212135693857/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JLeong_0-1769827497044.png" alt="JLeong_0-1769827497044.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Sat, 31 Jan 2026 02:46:04 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3478953#M5964</guid>
      <dc:creator>JLeong</dc:creator>
      <dc:date>2026-01-31T02:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Client Script not working in Service Operations Workspace</title>
      <link>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3478957#M5965</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi JLeong,&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Technical Analysis:&lt;/STRONG&gt; The code is failing because &lt;STRONG&gt;DOM Manipulation&lt;/STRONG&gt; (using document, window, or $) is strictly restricted in the Service Operations Workspace (SOW).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Workspaces are built on the &lt;STRONG&gt;Now Experience UI Framework&lt;/STRONG&gt;, which utilizes &lt;STRONG&gt;Shadow DOM&lt;/STRONG&gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;In Classic UI, the HTML is open and accessible.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In Workspace, components are encapsulated. Your script (document.getElementsByClassName) searches the top-level document, but it cannot penetrate the "Shadow Boundary" of the component where those links reside. It returns empty/null because it literally cannot "see" inside the component.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;The Solution:&lt;/STRONG&gt; You cannot cherry-pick/hide specific HTML elements (like just the links) inside a field or formatter in Workspace. You must handle the &lt;STRONG&gt;entire field/formatter&lt;/STRONG&gt; or use &lt;STRONG&gt;Standard UI Actions&lt;/STRONG&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Approach 1: Hide the Container (If it is a Formatter)&lt;/STRONG&gt; Those links typically belong to the &lt;STRONG&gt;Approval Summarizer&lt;/STRONG&gt; or a generic Macro formatter. Instead of trying to hide the specific .web class elements, you should hide the field that contains them.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Find the variable/field name of that section (e.g., approval_history, summary, or the variable editor name).&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Use standard API:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;JavaScript&lt;/SPAN&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;// Instead of DOM manipulation&lt;/SPAN&gt;
&lt;SPAN class=""&gt;if&lt;/SPAN&gt;(g_form.getValue(&lt;SPAN class=""&gt;'u_request'&lt;/SPAN&gt;) == &lt;SPAN class=""&gt;''&lt;/SPAN&gt;) {
    &lt;SPAN class=""&gt;// Hide the entire formatter/field containing the links&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;// You need to find the specific element name in the form layout&lt;/SPAN&gt;
    g_form.setVisible(&lt;SPAN class=""&gt;'variable_summary'&lt;/SPAN&gt;, &lt;SPAN class=""&gt;false&lt;/SPAN&gt;); &lt;SPAN class=""&gt;// Example name&lt;/SPAN&gt;
}&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Approach 2: View Rules (Recommended)&lt;/STRONG&gt; If you cannot hide it via script because it is a Formatter without a clean name:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;P&gt;Create a specific &lt;STRONG&gt;View&lt;/STRONG&gt; for SOW.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;In that View, simply &lt;STRONG&gt;remove&lt;/STRONG&gt; the formatter/field that generates those text links.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Rely on the standard Workspace Header Buttons (UI Actions) for Approve/Reject, which are controlled by standard UI Action Conditions/Visibility.&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;STRONG&gt;Summary:&lt;/STRONG&gt; document.getElementsByClassName will &lt;STRONG&gt;never&lt;/STRONG&gt; work reliably in SOW due to Shadow DOM encapsulation. You must move to hiding the whole field via g_form or managing visibility via Form Layouts/Views.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;If this explanation clarifies the Workspace limitation, please mark it as Accepted Solution.&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Brandão.&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jan 2026 03:06:18 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3478957#M5965</guid>
      <dc:creator>Itallo Brandão</dc:creator>
      <dc:date>2026-01-31T03:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Client Script not working in Service Operations Workspace</title>
      <link>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3479714#M5973</link>
      <description>&lt;P&gt;Thank you Itallo for the very clear explaination. Appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Feb 2026 11:55:05 GMT</pubDate>
      <guid>https://www.servicenow.com/community/community-central-forum/client-script-not-working-in-service-operations-workspace/m-p/3479714#M5973</guid>
      <dc:creator>JLeong</dc:creator>
      <dc:date>2026-02-02T11:55:05Z</dc:date>
    </item>
  </channel>
</rss>

