How to Dynamically Display Record Producer Variables and Apply Catalog UI Policies and Client Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Community,
I am working on a requirement to create a custom leave request submission UI in the ServiceNow Employee Center portal.
I have created a custom page and widget to implement a four-step leave request wizard.
Current Implementation:
Step 1 – Select Leave Type: The user selects the type of leave they want to request.
Step 2 – Enter Leave Details: The form fields are displayed based on the selected leave type. Currently, these fields are manually defined in the widget script.
Step 3 – Review Details: Display all applicable field values entered or selected by the user in Step 2 so they can review the information before submission.
Step 4 – Confirmation: Display a confirmation message after the request has been successfully submitted.
Requirements:
Dynamically display the variables configured in the corresponding Record Producer based on the leave type selected in Step 1, instead of hardcoding the fields in the widget.
Ensure that all applicable Catalog UI Policies and Catalog Client Scripts associated with the selected Record Producer work as expected, including field visibility, mandatory conditions, and other client-side behaviors.
In Step 3, display the applicable fields and their values entered by the user in Step 2.
On final submission, create an HR Case record in the "sn_hr_core_case" table using the selected Record Producer and the submitted variable values.
In Step 4, display a confirmation message after successful submission, preferably including the created HR Case number.
Retain the custom UI design and four-step navigation.
Questions:
Is there an out-of-the-box or supported approach to dynamically render Record Producer variables within a custom Employee Center widget?
Can the associated Catalog UI Policies and Catalog Client Scripts execute correctly when the variables are rendered dynamically in a custom widget?
Is there a recommended ServiceNow API or component for reusing the existing Record Producer configuration and client-side logic?
How can I implement the review and confirmation steps while ensuring that the submitted values are processed through the selected Record Producer and the HR Case is created correctly?
I would appreciate any recommendations, documentation, or examples of similar implementations.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wednesday
If you want to retain the four-step wizard, I'd recommend reusing the existing Service Catalog rendering framework rather than manually building the Record Producer variables in your widget.
ServiceNow supports dynamic widgets, but manually rendering variables using custom HTML won't automatically execute the associated Catalog UI Policies and Catalog Client Scripts.
Use the OOTB Service Catalog item experience to render the selected Record Producer and its variables.
Check whether you can reuse the standard catalog item widget within your Employee Center page.
Let the catalog framework handle variable visibility, mandatory conditions and client-side scripts.
Build your review step using the entered variable values.
Submit through the Record Producer so its server-side script processes the data and creates the HR Case.
Capture the created record's sys_id and number to display on the confirmation screen.
I'd avoid directly inserting records into sn_hr_core_case using GlideRecord, as this bypasses the normal Record Producer processing.
One important point: if you build a completely custom variable renderer, you'll also need to recreate the client-side behavior. That can become difficult to maintain.
References:
My recommendation is to keep the four-step navigation custom, but let ServiceNow handle the actual Record Producer form and submission.