How to get the id f...
 
Notifications
Clear all

[Solved] How to get the id from trigger.new and use in where clause

2 Posts
1 Users
0 Likes
323 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

In Salesforce Apex, how to get the id from trigger.new and use it as a bind variable in the where clause?

Issue Tags
1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

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;

Reply
Share: