You need to sign in to do that
Don't have an account?

how to get the data in new line in apex salesforce lightning
Hi i want to display the data in newline and i tried with <br/> and </n> but it was not working. And my code is
for( Opportunity oppLst : [Select Id,Name,Cart_Grand_Total__c, (Select Product_SKU__c,DeliveryDate__c from Shopping_cart_line_items__r where DeliveryDate__c >Today )
from Opportunity where AccountId =:accountId and StageName='Closed Won' ])
{
for(Shopping_cart_line_item__c scL : oppLst.Shopping_cart_line_items__r){
DateTime DeliveryDate = scL.DeliveryDate__c;
upcmngDeleviries += DeliveryDate.format('MM/dd/yyyy')+'\n';
}
upcmngDeleviries +='$'+oppLst.Cart_Grand_Total__c +'\n';
}
return upcmngDeleviries ;
Actual Output: 01/23/2020 $660.29 01/22/2020 01/22/2020 $1373.84
Expected Output : 01/23/2020 $660.29
01/22/2020 01/22/2020 $1373.84
for( Opportunity oppLst : [Select Id,Name,Cart_Grand_Total__c, (Select Product_SKU__c,DeliveryDate__c from Shopping_cart_line_items__r where DeliveryDate__c >Today )
from Opportunity where AccountId =:accountId and StageName='Closed Won' ])
{
for(Shopping_cart_line_item__c scL : oppLst.Shopping_cart_line_items__r){
DateTime DeliveryDate = scL.DeliveryDate__c;
upcmngDeleviries += DeliveryDate.format('MM/dd/yyyy')+'\n';
}
upcmngDeleviries +='$'+oppLst.Cart_Grand_Total__c +'\n';
}
return upcmngDeleviries ;
Actual Output: 01/23/2020 $660.29 01/22/2020 01/22/2020 $1373.84
Expected Output : 01/23/2020 $660.29
01/22/2020 01/22/2020 $1373.84
Include a line break within a String with the use of '< br/>' and displaying it on the component as follows
<aura:unescapedHtml value="{!v.yourString}" />
https://developer.salesforce.com/docs/component-library/bundle/aura:unescapedHtml/specification
I hope this helps you.