Client Script not working in Service Operations Workspace
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hello!
How do I make this code work in Service Operation Workspace? I am trying to remove the Deny / Accept link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi JLeong,
Technical Analysis: The code is failing because DOM Manipulation (using document, window, or $) is strictly restricted in the Service Operations Workspace (SOW).
Workspaces are built on the Now Experience UI Framework, which utilizes Shadow DOM.
In Classic UI, the HTML is open and accessible.
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.
The Solution: You cannot cherry-pick/hide specific HTML elements (like just the links) inside a field or formatter in Workspace. You must handle the entire field/formatter or use Standard UI Actions.
Approach 1: Hide the Container (If it is a Formatter) Those links typically belong to the Approval Summarizer or a generic Macro formatter. Instead of trying to hide the specific .web class elements, you should hide the field that contains them.
Find the variable/field name of that section (e.g., approval_history, summary, or the variable editor name).
Use standard API:
JavaScript// Instead of DOM manipulation if(g_form.getValue('u_request') == '') { // Hide the entire formatter/field containing the links // You need to find the specific element name in the form layout g_form.setVisible('variable_summary', false); // Example name }
Approach 2: View Rules (Recommended) If you cannot hide it via script because it is a Formatter without a clean name:
Create a specific View for SOW.
In that View, simply remove the formatter/field that generates those text links.
Rely on the standard Workspace Header Buttons (UI Actions) for Approve/Reject, which are controlled by standard UI Action Conditions/Visibility.
Summary: document.getElementsByClassName will never 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.
If this explanation clarifies the Workspace limitation, please mark it as Accepted Solution.
Best regards,
Brandão.
