How to show Record Producer variables on Incident form for agents.

siddharthjain09
Tera Contributor

Hello Everyone,

 

I have a requirement related to the Incident form in ServiceNow, and I would appreciate your suggestions on how to achieve this.

We have several Record Producers that create incident records. Each record producer has its own set of variables, apart from the standard incident fields (like Category and Subcategory).

Now, we want to enable agents (on the platform UI) to create incidents directly from the Incident form, but with an option to select a Record Producer, so that:
• All the variables associated with that selected Record Producer should be displayed (ideally in a popup or a widget).
• The agent can fill those variable values directly while creating the incident.
• Once submitted, those variable values should be stored along with the incident record (just like they are when the record is created via the Record Producer).

In short, the goal is to have a way for agents to select a Record Producer on the Incident form and dynamically show all the variables related to it — similar to how the portal record producer form behaves.

We are considering adding a field on the Incident form (e.g., “Record Producer”) from which the agent can select the record producer, and then the related variables should be displayed for input.

Has anyone implemented something similar or can suggest the best approach (maybe a UI page, UI Macro, or Service Portal widget)?

 

Thanks,

Siddharth

1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@siddharthjain09 

you can create a form UI action which displays record producers associated to incident using UI page and then based on record producer they select open the record producer within the native

how to invoke UI page using GlideModal

GlideModal - Client 

something like this

HTML:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <g:ui_form>
        <g:evaluate jelly="true" object="true">
            var gr = new GlideRecord('sc_cat_item');
            gr.addQuery('sys_class_name', 'sc_cat_item_producer');
            gr.addQuery('table', 'incident');
            gr.query();
            gr;
        </g:evaluate>
        <select id="producerSelect">
            <j:while test="${gr.next()}">
                <option value="${gr.sys_id}">${gr.name}</option>
            </j:while>

        </select>
        <button onclick="openProducer()">Open Record Producer</button>
        <script>
            function openProducer() {
                var select = document.getElementById('producerSelect');
                var sysId = select.value;
                if (sysId) {
                    window.open('/com.glideapp.servicecatalog_cat_item_view.do?sysparm_id=' + sysId, '_blank');
                }
            }
        </script>
    </g:ui_form>
</j:jelly>

Output:

open record producer via ui page.gif

I hope this much information is sufficient for you to get started and you can enhance it further from here based on your requirement and developer skills.

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader