+ Start a Discussion

How do I query the a custom object and not included the current record

I have a trigger on the a custom object called offer.  Within this trigger I need to verify that ther exist no OTHER offers with the same status as the current Offer.  There is only one offer, this is the current offer.  I create a map to store the results and this one offer is of course in the map.


How do I disregard the current record when its included in the map.

Sam MohyeeSam Mohyee
Can you clarify what your intention is?

Do you want your SOQL query to not return the offer that set off the trigger? In that case make sure your SOQL query has something like
WHERE ID != :Trigger.New

Trigger.New returns IDs of every record that set off the trigger, aka the 'current' offer.