+ Start a Discussion
giri rockzzzzgiri rockzzzz 

need help in triggers

Error: Compile Error: Initial term of field expression must be a concrete SObject: LIST<purchase_order_lines__c> at line 5 column 14


trigger MyFirstObjectTrigger on purchase_order_lines__c (after update) {

public purchase_order_lines__c[] pol=Trigger.new;

Integer diff=pol.received_quantity__c;

for (integer i=0 ;i<diff;i++){
Product_serial__c  obj = new Product_serial__c(product__c=pol.product__c,purchase_order_receipt__c=pol.purchase_order_receipt__c);
insert obj;



can anyone tell me how to resolve this error?????plz............

Best Answer chosen by Admin (Salesforce Developers) 



public purchase_order_lines__c[] pol=Trigger.new;


in this line you are taking all the row. But 


Integer diff=pol.received_quantity__c;


in above line you are treating pol variable pf objects. Instead of above just use this line


Integer diff=pol[0].received_quantity__c; 


use every where same like this.