Iframe with script so i get the current page incident details like subject , description upon click

Aditya007aa
Tera Contributor

Hi Everyone,

I am able to create an iFrame inside the Incident page.

Now I want to auto populate those current Incident records like Incident Number & Incident Subject when I click on a process button so it auto populates those details into my A360 process.

 

Or 


I have also created a Widget with scripts added there and I am able to add that widget in "Home" page only, I want to add that widget in the "Incident" page that will solve my problem very easily.

If anyone can help me with either of the issue, it would be so helpful.

15 REPLIES 15

Ankur Bawiskar
Tera Patron
Tera Patron

@Aditya007aa 

why not show UI page and pass the form field value to it and then use that in your UI page?

So you are showing widget on form but how? is it via some UI macro?

Did you try to access the current field value using current.fieldName in g:evaluate tag?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Yes, I have used UI macro to show iFrame inside each Incident Record Page, I have tried to get the values of each record page but i want to populate only when i click on my process button. I have attached the screenshot highlighted it with red color , so when i press that i should auto-populate those incident records to my form. 

This is my code in UI Macro

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<iframe src="https://aa-saleseng-us-4sbx.cloud.automationanywhere.digital/copilot" height="900px" width="1800px"></iframe>
</j:jelly>
I tried to write the code using "Current.fieldName" but how to populate it only when i press that red highlighted buton.ServiceNow-Incident-Page.JPGServiceNow-UI-Macro.JPG

@Aditya007aa 

in your UI macro get the record sysId or incident number

But I could see in iframe directly you are invoking the external URL, so I believe you cannot pass it there

The UI which gets rendered comes from external URL and is not within ServiceNow instance

Can you paste the URL here so that I can check in my PDI?

AnkurBawiskar_0-1741770072088.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Hi Ankur,

 

I tried this way also where i create a Widget & then create a formatter & then add the same formatter in my incident page layout. This is the below steps:-

If your widget is built using Service Portal, follow these steps:

Steps to Add a Widget to the Incident Form

  1. Create a Widget

    • Navigate to Service Portal → Widgets.
    • Click New and configure your widget.
  2. Add the Widget to the Incident Form

    • Go to System UI → Formatters.
    • Click New.
    • Enter:
      • Name: Incident Widget
      • Table: incident
      • Formatter: sp_widget
      • Widget: Select your newly created widget.
    • Click Submit.
  3. Modify the Incident Form Layout

    • Navigate to System UI → Forms → Form Layout.
    • Select the Incident Table.
    • Under Available Fields, find your new formatter (e.g., Incident Widget).
    • Move it to the Selected Fields section.
    • Click Save.

I am able to perform this step & also add the same to my incident page but nothing seems to happen.

Also this is the URL:-

https://aa-saleseng-us-4sbx.cloud.automationanywhere.digital/copilot

 

I have attached how i created the System - Widget & added my iframe & Client Script , it works well when i add the iframe to my Home page but not when i do the same thing in Incident Page.

 

If required we can connect on zoom for 5-10 minutes to resolve the issue. Let me know.

 

Thanks for helping