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
pradyprady 

Save error: Initial term of field expression must be a concrete SObject: LIST<QuoteLineItem>

Hi,

 

I am writing a trigger on update but  i get this error

Save error: Initial term of field expression must be a concrete SObject: LIST<QuoteLineItem>.

I am not sure what is causing this. Here is my code

 

trigger Update_Discount_on_QuoteLineItem on Quote (after update) {
	
	List <QuoteLineItem> QLI = new List <QuoteLineItem>();
	Map<id,double> MapSoftwareDiscount= new Map <id,double>();
	Map<id,double> MapHardwareDiscount= new Map <id,double>();
	Set <id> Qid= new Set<id>();
	
	for (Quote  Q: Trigger.new)
	{
		if (Q.Software_Discount__c!=System.Trigger.oldMap.get(Q.Id).Software_Discount__c ||Q.hardware_Discount__c!=System.Trigger.oldMap.get(Q.Id).hardware_Discount__c )
		{
			Qid.add(Q.id);
			MapSoftwareDiscount.put(Q.id,Q.Software_Discount__c);
			MapHardwareDiscount.put(Q.id,Q.hardware_Discount__c);
			
		}
	}
	
	QLI=[select id,QuoteId,product_category__c,Discount from QuoteLineItem where QuoteId in :Qid];
	for(integer i=0; i <QLI.size();i++)
	{
		if (QLI[i].product_category__c=='Software')
		{
			QLI[i].Discount=MapSoftwareDiscount.get(QLI.QuoteId); //ERRORS OUT HERE
		}
		else if(QLI[i].product_category__c=='Hardware')
		{
			QLI[i].Discount=MapHardwareDiscount.get(QLI.QuoteId);
		}
	}
	update QLI;
	
	

}

 

Any ideas what is causing this

 

Best Answer chosen by Admin (Salesforce Developers) 
pradyprady

Ok i got what the issue was.

 

QLI[i].Discount=MapSoftwareDiscount.get(QLI[i].QuoteId); 

 

I didnt include the [i] in the get (QLI[i].QuoteId