You need to sign in to do that
Don't have an account?

Not Sure How To Bulkify This
The issue here is that I'm looking at 2 values - phone number and message (text). I need to do a lookup to find the contact that belongs to the phone number and update a field on the contact with the message associated with that phone number. I'm not sure how to do that. I created the trigger and it works this way, but I know it's a bad practice. Can you help me bulkify this:
for(TwilioSF__Message__c msg : Trigger.new){ if(msg.TwilioSF__Status__c == 'received'){ List<Contact> cons = [SELECT Id FROM Contact WHERE MobilePhone = :msg.TwilioSF__From_Number_Unformatted__c]; for(Contact con : cons){ con.NewTextMessage__c = true; con.TxtMsg__c = msg.TwilioSF__Body__c; update con; } } }Any help is much appreciated.

Here is the code