UIB Builder: Catalog Item component

Bhaskar M
Tera Contributor

Hi,

 

I have a record producer - Create Incident

Created a new page in UI Builder(input table and sysId), added to declarative action - Create Incident

This declarative action created on security incident.

On clicking declarative action "create incident", one popup is opening and showing create Incident record producer.

Question : Now I want to populate few reference and string variables on Create Incident record producer, when popup is opening based on the security incident record data

Please can someone help me on this, If I use form component, I can able to populate but we don't want to use that as there is many security rules are getting impacted

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@Bhaskar M 

Can you share complete details on what have you configured so far with screenshots?

Did you try checking how to send the data?

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

Hi,

Thanks for the response. Please find below steps that I have implemented

1 - Created a UI page and variant (ex: record_producer) and did some changes to open as modal

1.1 - url parameters are table and sysId

2 - Added a component - catalog item , in the configuration provided the sys_id of record producer

2.1 - record producer have short description(string) and parent(reference to task table)

3 - Created a declarative form action (table sn_si_incident) and configured to open the modal, created on step 1 (this is working find) 

4 - Created a data source to get the sn_si_incident table data (ex: short description) based on the url parameter and able to get the data as well

   Now I want to set this short description( fetched on step 4) to set into record producer short description

KKM
Tera Guru

Hi @Bhaskar M,
To populate reference and string variables in the Create Incident record producer popup based on the Security Incident record data, you can follow these approaches:
Solution: Use URL Parameters to Pre-Fill Record Producer Fields
Since you're triggering the Create Incident record producer via a declarative action, you can pass values through URL parameters.
Steps:
Identify Variable Names:
Go to your Create Incident record producer (sc_cat_item table).

Find the variable names you want to populate (e.g., caller_id, short_description).

Modify the Declarative Action URL:

Update the action to open the record producer with pre-filled values using the sysparm_variables parameter.

The URL should be:

/sp?id=sc_cat_item&sys_id=<Record_Producer_SYSID>&sysparm_variables=caller_id=<caller_sysid>^short_description=Test Incident

Dynamically Populate from Security Incident:

Instead of hardcoding, dynamically populate values from the security incident record.

Example URL within the declarative action:

/sp?id=sc_cat_item&sys_id=YOUR_RECORD_PRODUCER_SYSID &sysparm_variables=caller_id=${current.caller_id}^short_description=${current.short_description}

Ensure Variables Are Named Correctly:

The variables in the URL must match the variable names in your record producer (not labels).

Alternative: Client Script in Record Producer
If some data is complex (like reference fields), you can use a client script inside the record producer:
function onLoad() { var securityIncident = g_form.getParameter('sysparm_security_incident'); if (securityIncident) { g_form.setValue('caller_id', securityIncident.caller_id); g_form.setValue('short_description', securityIncident.short_description); } }

Ensure you pass sysparm_security_incident=${current.sys_id} in your URL and fetch details using a GlideAjax script if needed.

The popup is simply a URL redirection.

ServiceNow's sysparm_variables helps pre-fill data without needing a form component.

No security rule violations since you're using OOTB (out-of-the-box) functionality.

Would this approach work for your scenario?

Kindly mark it as correct/helpful, as it resolves your query. Please press like button for the resolution provided.

With Best Regards,

Krishna Kumar M



Bhaskar M
Tera Contributor

Hi Thanks you for the response.

 

This is working fine, if we are opening as separate tab. We want to open it as  modal. 

when we are opening as modal, the URL is not changing

example :

URL: https://dev294201.service-now.com/now/sir/record/sn_si_incident/4962c968838c6210633fb1d6feaad305

g_form.getParameter(<url parameter of page>) , is not working in onload client script.
 
is there anyway, I can achieve this in Modal