New project workspace: How to hide "update form" button in personalize form

PatriciaA987250
Tera Expert

Hi,

 

I would like to hide the "update form" button from personalize form in the new project workspace. The personalize form resides in all the related list under more form option. Could someone share step-by-step guide to achieve this. Kindly refer to attached screenshot. Thank you

 

Personalize form- update button.png

1 REPLY 1

sadif_raja
Tera Guru

@PatriciaA987250 

To hide the "Update Form" button from the Personalize Form option in ServiceNow's Project Workspace, you will need to adjust the form's UI actions and use either UI policies, client scripts, or ACLs to control the visibility of specific elements. Here's a step-by-step guide on how to achieve this:

Step 1: Identify the Button or UI Action

  1. Navigate to the Form: Open the Project Workspace and locate the form where the "Update Form" button is available in the related lists.
  2. Inspect the Button: If you're unsure of the exact UI action name or script, inspect the form using the "Inspect Element" tool in the browser or by checking the Form Layout.
  3. Identify the UI Action: Go to the "UI Actions" table (sys_ui_action.list) in ServiceNow to identify the "Update Form" button associated with that form.

Step 2: Modify the UI Action (Hide It)

  1. Navigate to UI Actions:
    • In the left-hand navigation, type "UI Actions" and go to the UI Actions list (sys_ui_action.list).
    • Use filters to find the specific UI Action for "Update Form."
  2. Set Conditions:
    • In the UI Action record, you can control the visibility by adding conditions under the Visible/Condition field. For example, you can add a condition like:
      javascript
      gs.getUser().hasRole('admin') == false;
    • This will ensure that the button is hidden unless the user is an admin.
  3. Save the Changes: Update the UI Action by clicking Save.

Step 3: Use ACLs (Optional)

If you want to control visibility based on specific user roles or groups:

  1. Navigate to ACLs: Go to System Security > Access Control (ACL).
  2. Create an ACL for the Update Form:
    • Choose the Type as UI Action.
    • Set the appropriate conditions to restrict access to the "Update Form" button based on user roles or other criteria.

Step 4: Use a Client Script (Optional)

If the UI Action modification is not sufficient or you need further control, you can use a Client Script to hide the button.

  1. Navigate to Client Scripts: Go to System Definition > Client Scripts.
  2. Create a New Client Script:
    • Scope it to the form and related list where the button appears.
    • Use a script like this to hide the "Update Form" button:
      javascript
      function onLoad() { var updateFormButton = g_form.getControl('sysverb_update'); if (updateFormButton) { updateFormButton.style.display = 'none'; } }
  3. Save and Test: Ensure the Client Script works as expected in the Project Workspace.

Step 5: Test and Verify

  1. Test the changes in the Project Workspace and ensure that the "Update Form" button is hidden as desired.
  2. Verify the visibility for different roles (admin, regular users, etc.) to ensure the functionality works correctly.

Let me know, if it works for you.