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

Need to Bulkify Trigger Not Supporting Mass update
Hi All,
I have the below Trigger which updates a Guest(Object) Email ID when the Contact(Object) Email ID is updated. The Error now is Im getting an Apex Time Limit Exceeded Error,As the Number of Guests is more for a single contact it is not able to change the email id to all the related guests email id.ie)not able to update the email id of all the guests associated with the single contact so the time limit exceeded error.
Please suggest ways to Support this for many Records. In a way to bulkify.
Thanks
Abraham
I have the below Trigger which updates a Guest(Object) Email ID when the Contact(Object) Email ID is updated. The Error now is Im getting an Apex Time Limit Exceeded Error,As the Number of Guests is more for a single contact it is not able to change the email id to all the related guests email id.ie)not able to update the email id of all the guests associated with the single contact so the time limit exceeded error.
Please suggest ways to Support this for many Records. In a way to bulkify.
rigger CopycontactAddressToguestAddress on contact (after update) { Map<Id, String> m = new Map<Id, String>(); for (contact c : Trigger.new) { contact old = Trigger.oldMap.get(c.Id); if (c.Email != old.Email) { m.put(c.Id, c.Email); } } if (m.size() > 0) { Guest_New__c[] guests = [ select Id, contact__c from Guest_New__c where contact__c in :m.keySet() ]; for (Guest_New__c c : guests) { c.Email__c = m.get(c.Contact__c); } update guests; } }
Thanks
Abraham
You can use Process builder to achieve this functionality. Is there any specific need to use trigger ?
Thanks
Abraham
Try below coe
https://www.youtube.com/watch?v=1pECPZ0kqpQ
Sorry Im new..., Can you give me some Expanations on the code By adding this can the problem be solved contact__c!=null.
Thanks
Abraham
For now Ill stick with fixing the error in the Trigger nitish.. Lets not change it fully now to process builder now . please let me know any thoughts on bulkifying this so that it does not give error.
many thanks in Advance
Thanks
Abraham
Yes I use contact update on a different trigger also on the contact object,but Im getting below Details in Debug log. Related to this trigger only i guess
Many Thanks in Advance
Abraham
The issue is with the 3rd line of below code shown in above debug log which gives this error.
Please help to resolve. Many thanks
Abraham
Pls find full code