Hide section of a form on Agent Workspace

pauladams
Tera Contributor

Hello Gurus,

I am trying to hide sections on a Requested Item form using g_form.setSectionDisplay("section_name", false). This perfectly works fine on a regular form/view of the platform.

The problem is with the Agent Workspace and is not hiding the section/sections.

Can you please help me understand if g_form.setSectionDisplay is supported on Agent Workspace? Or are there any other alternatives?

 

Thanks in advance

-Pa

5 REPLIES 5

Willem
Giga Sage
Giga Sage

Hi Paul,

g_form.setSectionDisplay should be supported in Agent Workspace. As the Knowledge base links to:

https://docs.servicenow.com/bundle/newyork-servicenow-platform/page/build/service-portal/reference/c...

(describes the supported client type scripts and API for Service portal, but same scripts will work for agent workspace).

 

Alternatively what you can do is set up a new View, without the sections, and via Workspace View Rules apply the view when applicable. This feels like more setup work, but is the No-code/low-code way of doing it.

https://docs.servicenow.com/bundle/paris-servicenow-platform/page/administer/workspace/task/workspac...

 

I've used g_form.setSectionDisplay in the Workspace UI with a UI Policy Run Script set to All.  Is there official documentation stating it is not supported?

 

For fun try a UI Policy, Run Script set to All, I didn't put any conditions in, I just wanted to hide Related Records always, but this can be flipped if using conditions:

 

Execute if true:

function onCondition() {
g_form.setSectionDisplay('related_records', false);
}

Execute if false:

function onCondition() {
g_form.setSectionDisplay('related_records', false);
}

You are right Ashley, I will update accordingly.

It should be supported as it is also supported in the Service Portal.

 

Willem
Giga Sage
Giga Sage

Where are you using this script? Make sure the UI Type is set to 'All' if you use it in client script:

find_real_file.png