function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
kumar_arunkumar_arun 

How to show a formula field(have Image) of an object in lightning component.

I want to show formula field that is in Lead Object,And this formula field contains Image. when i call this field in component in OutputText it show url of Image. please help me. I don't know how to use OUTPUTRICHTEXT
Component:

<aura:component controller="LeadLightningContoller">
	 <ltng:require styles="/resource/SLDS103/assets/styles/salesforce-lightning-design-system.min.css"/>
    <aura:attribute name="Leads" type="Lead[]"/>
    <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>

 <aura:iteration items="{!v.Leads}" var="lead">

 <ui:outputText value="{!lead.Rating_Image__c}"/>

 </aura:iteration>
 
helper Class

({
	getLeadList : function(component) {
        
        var action=component.get("c.ShowLead");
        action.setCallback(this,function(res){
           
            var status=res.getState();
            if(status=="SUCCESS"){
                component.set("v.Leads",res.getReturnValue());
            }
        });
		$A.enqueueAction(action);
	}
})
Controller


public class LeadLightningContoller {
    
    @AuraEnabled
    public static List<Lead> ShowLead(){
        
        List<Lead> leadList=new List<Lead>();
        
        leadList=[select Name,Email,Status,Phone,No_of_days_Open__c,Rating,Fax,Rating_Image__c from Lead limit 10];
        return leadList;
       
    }

}
Application

<aura:application >
  <c:LeadData />
</aura:application>

 
kumar_arunkumar_arun
Sorry. Here is Component Controller
({
   doInit: function(component, event, helper) {      
       
      helper.getLeadList(component);
   }
});

 
Ricardo Coutinho 7Ricardo Coutinho 7
Same here...
Ricardo Coutinho 7Ricardo Coutinho 7
Hi Kumar,

I already know how it is.
Use the outputRichText tag, like this:

<ui:outputRichText value="{!contact.Image__c}"/>
ashu 6112ashu 6112
Hi,
I am using ui:outputRichText to display image and its working fine as expected, but i have to do something on selection of that record. How to acheive this. I am using click, dlbclick events but its not working. Anyone help please