iFrame Can we use Dynamically created URL to UI Macro

KKS515
Tera Contributor

I have created the iFrame with the following 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://abc.xyz" height="900px" width="1800px"></iframe> 
</j:jelly>
 
Needs to pass the URL dynamically based on the record values on the incident the below query paramter location; the value of location is derived from the Incident record dynamically based on the Server locations.
 
 
<?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://abc.xyz?location=AZ" height="900px" width="1800px"></iframe> 
</j:jelly>
3 REPLIES 3

Tushar
Kilo Sage
Kilo Sage

Hi @KKS515 

 

This code should dynamically sets the location query parameter based on the location field of the incident record.

 

Make sure to include this code in your UI Macro to achieve your desired outcome.

 

<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
    <iframe src="https://abc.xyz?location={{incident.location}}" height="900px" width="1800px"></iframe>
</j:jelly>

 

 

Please, don't forget to mark my answer as correct if it solves your issue or mark it as helpful if it is relevant for you!

Regards,
Tushar

KKS515
Tera Contributor

Thanks Tushar. We were able to create those jelly on UI macro. The issue is on the Macro is it won't get refreshed automatically during record change. 

 

We are exploring alternatives on the macro. 

Sohithanjan G
Kilo Sage
Kilo Sage

Hi @KKS515 

can you try this


<?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:evaluate var="incidentSysId" expression="${request.getParameter('sysparm_sys_id')}"/>

    <g:if test="${incidentSysId}">
        <g:evaluate var="incidentGR" expression="new GlideRecord('incident'); incidentGR.get(incidentSysId);"/>
        
        <g:if test="${incidentGR.isValid()}">
            <g:evaluate var="location" expression="incidentGR.getValue('location')"/>
            <iframe src="https://abc.xyz?location=${location}" height="900px" width="1800px"></iframe>
        </g:if>
    </g:if>
</j:jelly>



please mark as Accepted Solution / Helpful if you get it 🙂

Please mark as Accepted Solution if this solves your query and HIT Helpful if you find my answer helped you. This will help other community mates too..:)