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
Huy NguyenHuy Nguyen 

Invalid bind expression

Hi all,

I got that error in this code. Can anyone advise  ?

  Map<String,Line_Item_Type__c> newLineItemMap = new Map<String, Line_Item_Type__c>();
                for(Line_Item_Type__c lineItem : [SELECT Id,Line_Item_Category_Text__c,Line_Item_Type_Aggregated_Category__c,Name FROM Line_Item_Type__c where id =: trigger.new] )       
                {
                     newLineItemMap.put(lineItem.Line_Item_Type_Aggregated_Category__c, lineItem);
                }
sandeep sankhlasandeep sankhla

Hi Huy,
 
Plese replace this code with this

 Map<String,Line_Item_Type__c> newLineItemMap = new Map<String, Line_Item_Type__c>();
 
 
    for(Line_Item_Type__c lineItem : [SELECT Id,Line_Item_Category_Text__c,Line_Item_Type_Aggregated_Category__c,Name FROM Line_Item_Type__c where Id IN: trigger.new] )       
    {
         newLineItemMap.put(lineItem.Line_Item_Type_Aggregated_Category__c, lineItem);
    }

Let me know if it works else we can iterate and store Ids in set and then use that set..

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer