While Executing the Trigger:

set<decimal> offerLevels = new Set<decimal>();
Set<Id> pricebookIds = new Set<Id>();
set<string> productgroups = new set<string>();
set<string> ordertypes = new set<string>();

Map<String, List<order>> offerRuleMap = new Map<String, List<order>>();

List<Order> orders = [SELECT Id, Status, Pricebook2Id, Order_Qty_Multiplier__c, (SELECT Id,Pricebook__c FROM Order_Pricebooks__r), (SELECT OrderId,Product_Group__c,OrderType__c FROM OrderItems) FROM Order WHERE Id IN (SELECT OrderId FROM OrderItem WHERE Id IN :Trigger.newMap.keySet())];
 for(Order ord :orders){

   for(Orderitem ord2:ord.OrderItems){





   if(!offerRuleMap.containsKey(orders.Order_Qty_Multiplier__c + orders.Pricebook2__c + ord2.Product_Group__c + ord2.Type__c))

Last Line it is showing Error:

Error: Compile Error: Initial term of field expression must be a concrete SObject: List Order,

How to Rectify the Error

  • This line: orders.Order_Qty_Multiplier__c + orders.Pricebook2__c + ord2.Product_Group__c + ord2.Type__c. You are accessing individual fields with List object. I guess it should be like this: ord.Order_Qty_Multiplier__c + ord.Pricebook2__c + ord2.Product_Group__c + ord2.Type__c – Shailesh Patil Aug 9 '16 at 6:14
  • After changing that Compile Error: Arithmetic expressions must use numeric arguments – SFDC Aug 9 '16 at 6:18

As in the error description, you are trying to access fields of an sObject using an instance of type List which is causing the issue.

Update your if condition as in below. You were using the list instance(orders) itself earlier.

if(!offerRuleMap.containsKey(ord.Order_Qty_Multiplier__c + ord.Pricebook2__c + ord2.Product_Group__c + ord2.Type__c))
  • After changing Error: Compile Error: Arithmetic expressions must use numeric arguments at – SFDC Aug 9 '16 at 6:23
  • This might be due to different field types. Try adding String.valueof(yourField) for fields which are not type of String e.g. String.valueof(ord.Order_Qty_Multiplier__c) – highfive Aug 9 '16 at 6:28
  • Glad it helps you! – highfive Aug 9 '16 at 6:31
  • Order_Pricebooks__c is a child of Order where you can have multiple Order_Pricebooks__c per Order. So the way you are trying to access it is not correct. You have to iterate over the children list. btw, it seems this is a different question from the original post – highfive Aug 9 '16 at 6:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.