You need to sign in to do that
Don't have an account?
GMASJ
Remove null string and align string in apex code
Hi,
In this below code.
Problem I have here is null and string alignment is one next to another Please suggest me for how to remove null and align string values one below another.
Thanks
Sudhir
In this below code.
public class OpportuntiyProductPurchased{ @InvocableMethod public static void OpplineProdPurch(List<ID> OppId){ String Str; list<opportunitylineitem> oplnlst = new list<opportunitylineitem>([select id, name,f_Entitlement_Product_Description__c from opportunitylineitem where opportunityid = :OppId]); list<opportunity> opplst = new list<opportunity>(); for(opportunity opp :[select id, Products_Purchased__c from opportunity where id = :OppId]){ for(opportunitylineitem opl : oplnlst){ system.debug(opl.f_Entitlement_Product_Description__c); Str += opl.f_Entitlement_Product_Description__c; If (Str <> null){ Str = Str; } } opp.Products_Purchased__c = Str; opplst.add(opp); } System.debug(Str); if(opplst.size() > 0){ update opplst; } } }Values are assigned to string and that string is getting updated to textarea field in opportunity.
Problem I have here is null and string alignment is one next to another Please suggest me for how to remove null and align string values one below another.
Thanks
Sudhir
Give a try with below code:
Hope this helps! Please mark as best if it does.
Thanks
All Answers
Give a try with below code:
Hope this helps! Please mark as best if it does.
Thanks
Thanks
Sudhir
Can you please try replacing '\\n' in line 19 of my code with '\n' (single slash n in quotes).
Thanks,
Sarvani