2

I'm trying to add a case flag to a custom lightning component.

Flag Field

IF(ISNULL(FLAGS__ViewedFlag__c),null, 
IF(FLAGS__Case_Flag_Age__c > (IF(ISBLANK(FLAGS__CaseTimeOffset4__c) , 
$Setup.FLAGS__FlagPref__c.FLAGS__TimeOffset4__c,FLAGS__CaseTimeOffset4__c)), 
IMAGE( "https://fuze-- 
fullfuze1.lightning.force.com/servlet/servlet.FileDownload?flagsort=" & 
FLAGS__Case_Flag_Age_Text__c & "&file=" & 
$Setup.FLAGS__FlagPref__c.FLAGS__Offset4Image__c, "L4", 16, 16), 
IF(FLAGS__Case_Flag_Age__c >= (IF(ISBLANK(FLAGS__CaseTimeOffset3__c ), 
$Setup.FLAGS__FlagPref__c.FLAGS__TimeOffset3__c,FLAGS__CaseTimeOffset3__c)), 
IMAGE( "https://fuze-- 
fullfuze1.lightning.force.com/servlet/servlet.FileDownload?flagsort=" & 
FLAGS__Case_Flag_Age_Text__c & "&file=" & 
$Setup.FLAGS__FlagPref__c.FLAGS__Offset3Image__c, "L3", 16, 16), 
IF(FLAGS__Case_Flag_Age__c >= (IF(ISBLANK(FLAGS__CaseTimeOffset2__c ), 
$Setup.FLAGS__FlagPref__c.FLAGS__TimeOffset2__c,FLAGS__CaseTimeOffset2__c)), 
IMAGE( "https://fuze-- 
fullfuze1.lightning.force.com/servlet/servlet.FileDownload?flagsort=" & 
FLAGS__Case_Flag_Age_Text__c & "&file=" & 
$Setup.FLAGS__FlagPref__c.FLAGS__Offset2Image__c, "L2", 16, 16), 
IF(FLAGS__Case_Flag_Age__c >= (IF(ISBLANK(FLAGS__CaseTimeOffset1__c ), 
$Setup.FLAGS__FlagPref__c.FLAGS__TimeOffset1__c,FLAGS__CaseTimeOffset1__c)), 
IMAGE( "https://fuze-- 
fullfuze1.lightning.force.com/servlet/servlet.FileDownload?flagsort=" & 
FLAGS__Case_Flag_Age_Text__c & "&file=" & 
$Setup.FLAGS__FlagPref__c.FLAGS__Offset1Image__c, "L1",16,16), 
IMAGE( "https://fuze-- 
fullfuze1.lightning.force.com/servlet/servlet.FileDownload?flagsort=" & 
FLAGS__Case_Flag_Age_Text__c &"&file=" & 
$Setup.FLAGS__FlagPref__c.FLAGS__BlankOffsetImage__c, "L0",16,16)) 
))) 
)

If I use

<lightning:formattedText value="{!item.Flag_New__c}"/></p>

I get

<img src="https://fuze-- 
 fullfuze1.lightning.force.com/servlet/servlet.FileDownload? 
 flagsort=00063033&amp; file=015a0000003xHlrAAE" alt="L4" style="height:16px; 
 width:16px;" border="0"/>

If I use formattedURL I get the following

 http://<img src="https://fuze-- 
 fullfuze1.lightning.force.com/servlet/servlet.FileDownload? 
 flagsort=00063060&amp; file=015a0000003xHlrAAE" alt="L4" 
 style="height:16px; width:16px;" border="0"/>

How do I remove the &amp that's being returned so that the image displays properly?

1

As you are directly getting the HTML markup you can use aura:unescapedHtml

<aura:unescapedHtml value="{!item.Flag_New__c}" />

However, if you are not using list of records, I would recommend to use outputField:

<lightning:recordViewForm recordId="00128000009j45uAAA"
                              objectApiName="Account">
        <!-- the messages component is for error messages -->
        <lightning:messages />

        <lightning:outputField fieldName="My_Image__c" />
    </lightning:recordViewForm>
1
  • Thanks the first answer worked beautifully. – Laura Bejjani Aug 26 '19 at 16:08

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.