How to run Client Scripts and UI Policies on HR Agent Workspace and Case Creation forms
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
We have set up our HR services with Record producers and have included them in our Employee Center. All of them have Catalog UI Policies and Catalog client scripts and they go to their respective COEs.
However on our HR Agent Workspace and Case Creation pages, we want the same policies and scripts to run on those services as well. We have set up UI Policies and Client Scripts on the sn_hr_core_case form only to realize that they are not working.
Is there any specialized interface that we need to run in order to replicate the same behavior as present in our Record Producers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @tahnalos
This is expected behavior. HR Agent Workspace does not run classic Client Scripts or UI Policies at all, even simple alert scripts, because Workspace is built on the Now Experience UI, not the classic UI16 form engine.
The way I think about it:
Record Producers and classic forms use one UI engine, while Agent Workspace uses a completely different one, so scripts written for the classic engine are simply ignored in Workspace.
There is no switch or interface to enable classic scripts on sn_hr_core_case in Workspace.
To run logic in Workspace, you must use:
Workspace Client Scripts (UI Type = Workspace / All)
Workspace-compatible UI Policies
Business Rules for core logic
Data Brokers / field mapping to pass data from Record Producers to case fields
Catalog and classic form scripts will never execute in Workspace.
If you find this useful, kindly mark it as Accept as Solution and Helpful.
Regards,
- Ankit
LinkedIn: https://www.linkedin.com/in/sharmaankith/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
And how do I make a Workspace Client Script and a Workspace-Compatible UI Policy? The documentation isn't as forthcoming on this regard.
And what about case creation? How would that work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @tahnalos
The key thing to understand is that there is no “case creation scripting mode” and no special toggle you’re missing. HR Agent Workspace and the case creation experience always run on the Now Experience UI engine, and that engine simply does not load classic Client Scripts or classic UI Policies at all.
Because of that, anything you want to execute in case creation or case view must be implemented directly on the case form using Workspace-aware artifacts. In practice, this means your logic must live in one of three supported layers:
Workspace Client Scripts, used for field-level interactions such as visibility, mandatory, or value changes. These are standard Client Scripts, but they only run if explicitly marked for Workspace and use supported g_form APIs.
Workspace UI Policies, used for simple condition-based field behavior. These also execute only when marked for Workspace.
Business Rules, used for validation or enforcement that must always run, regardless of whether the case is created from Workspace, classic UI, imports, or APIs.
There is no mechanism to reuse Record Producer UI behavior in Workspace. The supported design pattern is to treat Record Producers as data capture only, map the values into HR Case fields, and then apply all UI logic on the case fields themselves using Workspace scripts and policies.
So for case creation, the Workspace form loads, Workspace Client Scripts and Workspace UI Policies execute, Business Rules enforce final validation, and classic scripts are ignored by design.
Once you build with this separation in mind, the behavior becomes consistent and predictable across Employee Center, Agent Workspace, and APIs.
If you find this useful, kindly mark it as Accept as Solution and Helpful.
Regards,
- Ankit
LinkedIn: https://www.linkedin.com/in/sharmaankith/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I understand what you're saying but I need instructions on how to construct Workspace Client Scripts and Workspace UI Policies. I am not seeing that in the current ServiceNow documentation.
As for case creation, I am going to give them the feedback that the case creation option should not be used if we are intending on the HR team to always be using the Agent Workspace.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @tahnalos
That sounds reasonable, and I agree with your direction if Agent Workspace is going to be the primary interface for the HR team. If you receive any feedback or clarification from ServiceNow on this, it would be great if you could share it here as well, as it may help others running into the same questions.
Appreciate the discussion. This has been a useful thread.
If you find this useful, kindly mark it as Accept as Solution and Helpful.
Regards,
- Ankit
LinkedIn: https://www.linkedin.com/in/sharmaankith/
