• Viasur
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hello all,

 

I was wondering if this is possible with APEX code.

 

trigger NewCarEntry on Object (before insert) {
List<Object> newEntry = [SELECT id, Name FROM Object WHERE Color__c = 'Red'AND Model__c ='Seat'  LIMIT 1000];

//this is trigger and the list newEntry contains a number of items based Color__c and Model__c

for (Object o: Trigger.new) {
  if(*/here is where I want to know how to look in the newEntry list and if it finds a record that match the criteria in that list, to update a number of fields on that new record/*

 

I was wondering if this is possible. Create a list (SQOL Query)  based on a couple of fields and then use the IF statement to select those records that match the criteria on the list and update a number of fields on those records.

Can anyone help me with this?

 

Regards,

 

Carlos