Notifications
Clear all
Nov 03, 2021 9:36 am
In Salesforce Apex, how to get the id from trigger.new and use it as a bind variable in the where clause?
1 Reply
Nov 03, 2021 9:38 am
Here is an example:
Contact[] contacts = [SELECT LastName FROM Contact
WHERE AccountId IN :Trigger.new];
You can also get the current record Id as below:
Id id = Trigger,new[].Id;