Skip to main content
added 1413 characters in body
Source Link

I have a Description field of type Long Text Area. I'm trying to get the first few lines to display.

  1. I tried creating a formula field

    LEFT(Description, 500) I get Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description. 2.I tried using SOQL but I couldn't get it to work. 3.I also tried something like

    <apex:outputText value="{!LEFT(GoodMorning,4)}"/> and couldn't get it to work either. How can I get a substring ofI got the description fieldfollowing error : Failed to show up in a custom lightning componentsave HighlightComponent.cmp: c:HighlightComponent:26,75: No function found for key: LEFT: Source

How can I get a substring of the description field to show up in a custom lightning component. Here's my code:

Controller

public class HighlightComponentController {
@AuraEnabled        

    public static List<Case> findCase (Id recordId) {
        List<Case> details = [SELECT CaseNumber, OwnerId, Description 
                             FROM Case WHERE Id=:recordId];
        
        return details;
    }
    
    String description { get; private set; }

    public String truncatedDescription
    {
        get
        {
            return (description == null) ? null : description.abbreviate(3);
        }
    }
    
}

Component

<aura:attribute name="truncatedDescription" type="String" />
  <p><lightning:formattedText value="{!v.truncatedDescription}"/></p>

Javascript

{
  doInit : function(component, event, helper) {
    var action = component.get("c.findCase");
    action.setParams({
        recordId: component.get("v.recordId")
    });
    action.setCallback(this, function(data) {
        component.set("v.details", data.getReturnValue());
    });
    $A.enqueueAction(action);
    
    var action2 = component.get("c.truncatedDescription");
   
    action2.setCallback(this, function(data) {
        component.set("v.truncatedDescription", data.getReturnValue());
    });
    $A.enqueueAction(action2);
}

I have a Description field of type Long Text Area. I'm trying to get the first few lines to display.

  1. I tried creating a formula field

    LEFT(Description, 500) I get Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description. 2.I tried using SOQL but I couldn't get it to work. 3.I also tried something like

    <apex:outputText value="{!LEFT(GoodMorning,4)}"/> and couldn't get it to work either. How can I get a substring of the description field to show up in a custom lightning component.

I have a Description field of type Long Text Area. I'm trying to get the first few lines to display.

  1. I tried creating a formula field

    LEFT(Description, 500) I get Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description. 2.I tried using SOQL but I couldn't get it to work. 3.I also tried something like

    <apex:outputText value="{!LEFT(GoodMorning,4)}"/> I got the following error : Failed to save HighlightComponent.cmp: c:HighlightComponent:26,75: No function found for key: LEFT: Source

How can I get a substring of the description field to show up in a custom lightning component. Here's my code:

Controller

public class HighlightComponentController {
@AuraEnabled        

    public static List<Case> findCase (Id recordId) {
        List<Case> details = [SELECT CaseNumber, OwnerId, Description 
                             FROM Case WHERE Id=:recordId];
        
        return details;
    }
    
    String description { get; private set; }

    public String truncatedDescription
    {
        get
        {
            return (description == null) ? null : description.abbreviate(3);
        }
    }
    
}

Component

<aura:attribute name="truncatedDescription" type="String" />
  <p><lightning:formattedText value="{!v.truncatedDescription}"/></p>

Javascript

{
  doInit : function(component, event, helper) {
    var action = component.get("c.findCase");
    action.setParams({
        recordId: component.get("v.recordId")
    });
    action.setCallback(this, function(data) {
        component.set("v.details", data.getReturnValue());
    });
    $A.enqueueAction(action);
    
    var action2 = component.get("c.truncatedDescription");
   
    action2.setCallback(this, function(data) {
        component.set("v.truncatedDescription", data.getReturnValue());
    });
    $A.enqueueAction(action2);
}
Source Link

How Can I Get A Substring From A Long Text Area Field?

I have a Description field of type Long Text Area. I'm trying to get the first few lines to display.

  1. I tried creating a formula field

    LEFT(Description, 500) I get Error: You referenced an unsupported field type called "Long Text Area" using the following field: Description. 2.I tried using SOQL but I couldn't get it to work. 3.I also tried something like

    <apex:outputText value="{!LEFT(GoodMorning,4)}"/> and couldn't get it to work either. How can I get a substring of the description field to show up in a custom lightning component.