0

I'm working with lightning:recordForm and when adding an address field it displays like this:

enter image description here

And that text is a redirection to the google maps page:

enter image description here

But what I really want is that field to have the text with data and also a little iframe with the map itself like it's disposed in the details page of the record with the standard.

Is there a way to achieve this?

0

Not if you want to stick to using lightning:recordForm, because the 'linkifying' comes standard with Salesforce fields and there is nothing one can do about it. But you have options. Have you looked at lightning:recordEditForm? You could create a new generic component that handles iframe which you can embed within the parent component.

iFrame.cmp

<aura:component implements="forceCommunity:availableForAllPageTypes,flexipage:availableForAllPageTypes,force:hasRecordId,force:hasSObjectName">

    <aura:attribute name="recordId" type="String"/>
    <aura:attribute name="rootURL" type="String" default="" required="true"/>
    <aura:attribute name="frameWidth" type="String" default="100%"/>
    <aura:attribute name="frameHeight" type="String" default="600px"/>
    <aura:attribute name="allowScrolling" type="String" default="yes"/>
    <aura:attribute name="includeIdInURL" type="Boolean" default="false"/>

    <aura:attribute name="parameter1Name" type="String" default=""/>
    <aura:attribute name="parameter1Value" type="String" default=""/>
    <aura:attribute name="parameter2Name" type="String" default=""/>
    <aura:attribute name="parameter2Value" type="String" default=""/>
    <aura:attribute name="parameter3Name" type="String" default=""/>
    <aura:attribute name="parameter3Value" type="String" default=""/>
    <aura:attribute name="parameter4Name" type="String" default=""/>
    <aura:attribute name="parameter4Value" type="String" default=""/>
    <aura:attribute name="parameter5Name" type="String" default=""/>
    <aura:attribute name="parameter5Value" type="String" default=""/>

    <aura:if isTrue="{!!empty(v.rootURL)}">
        <iframe scrolling="{!v.allowScrolling}" src="{!v.rootURL + '?' + v.parameter1Name + '=' + v.parameter1Value + '&amp;' + v.parameter2Name + '=' + v.parameter2Value + '&amp;' + v.parameter3Name + '=' + v.parameter3Value + '&amp;' + v.parameter4Name + '=' + v.parameter4Value + '&amp;' + v.parameter5Name + '=' + v.parameter5Value + '&amp;output=embed' + if(v.includeIdInURL, '&amp;id=' + v.recordId, '') }" width="{!v.frameWidth}" height="{!v.frameHeight}" style="border:none;"></iframe>
        <aura:set attribute="else">
            No URL specified. 
        </aura:set>
    </aura:if>

</aura:component>

And then use it like so in:

lightning:recordEditForm

<aura:component>

        <lightning:recordEditForm
            recordId="a00R0000000jq5eIAA"
            objectApiName="Kal__c">
            <!-- the messages component is for error messages -->
            <lightning:messages />

            <lightning:inputField fieldName="Name" />
            <lightning:inputField fieldName="Address_c" />
            <lightning:inputField fieldName="Phone__c" />
            <c:iFrame rootURL="https://www.google.com"/>
            <div class="slds-m-top_medium">
                <lightning:button disabled="{!v.disabled}" variant="brand" type="submit" name="save" label="Save" />
            </div>
        </lightning:recordEditForm>


</aura:component>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.