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
sadik Shaiksadik Shaik 

I have a long text area field on QuoteLineItem object. I want to format the field something like this

I have a long text area field on QuoteLineItem object. I want to format the field something like this 
ShippedDate Quanity
02/23/2019      2
02/22/2019      4

I have a trigger something like this 
 List<QuoteLineItem> QLIShipItems = 
        [SELECT Id,ShipLineItemValues__c,Customer_Part_Number__c, (SELECT Confirmed_Quantity__c,Request_Confirmed_Date__c FROM Line_Item_Schedules__r) 
         FROM QuoteLineItem WHERE Id IN :Trigger.New];
            
            system.debug('QLIShipItems==='+QLIShipItems);
            
               // Map<Id, List<Line_Item_Schedule__c>> m = new Map<Id, List<Line_Item_Schedule__c>>();
            list<Line_Item_Schedule__c> LineItemScheduls= new List<Line_Item_Schedule__c>();
            list<QuoteLineItem> qtsToUpdate = new list<QuoteLineItem>();
             for(QuoteLineItem qlI : QLIShipItems ){
                 if(qli.Line_Item_Schedules__r!=null && !qli.Line_Item_Schedules__r.isEmpty()){
                     
                     system.debug('LineItemScheduls==='+qli.Line_Item_Schedules__r);
                     
                     for(Line_Item_Schedule__c lis : qli.Line_Item_Schedules__r ){
                         LineItemScheduls.add(lis);
                         qli.ShipLineItemValues__c = string.valueOf(lis.Request_Confirmed_Date__c);
                     }
                     qtsToUpdate.add(qlI);
                     system.debug('eachQtsToUpdate===='+qlI);
                 }
        }
           update  qtsToUpdate;   
                        
        }

Need your suggestions. Thanks in advance
Raj VakatiRaj Vakati
try this
 
List<QuoteLineItem> QLIShipItems = 
        [SELECT Id,ShipLineItemValues__c,Customer_Part_Number__c, (SELECT Confirmed_Quantity__c,Request_Confirmed_Date__c FROM Line_Item_Schedules__r) 
         FROM QuoteLineItem WHERE Id IN :Trigger.New];
            system.debug('QLIShipItems==='+QLIShipItems);
            list<Line_Item_Schedule__c> LineItemScheduls= new List<Line_Item_Schedule__c>();
            list<QuoteLineItem> qtsToUpdate = new list<QuoteLineItem>();
             for(QuoteLineItem qlI : QLIShipItems ){
                 if(qli.Line_Item_Schedules__r!=null && !qli.Line_Item_Schedules__r.isEmpty()){
					 
					 String qliResu = '' ; 
                     system.debug('LineItemScheduls==='+qli.Line_Item_Schedules__r);
                     for(Line_Item_Schedule__c lis : qli.Line_Item_Schedules__r ){
                        // LineItemScheduls.add(lis);
                        // qli.ShipLineItemValues__c = string.valueOf(lis.Request_Confirmed_Date__c);
						qliResuTemp = lis.Request_Confirmed_Date__c + '   ' +lis .Confirmed_Quantity__c +'/n'
						qliResu = qliResu+qliResuTemp ; 
                     }
					 qlI.ShipLineItemValues__c = qliResu ; 
                     qtsToUpdate.add(qlI);
                     system.debug('eachQtsToUpdate===='+qlI);
                 }
        }
           update  qtsToUpdate;   
                        
       }