• Abraham kumar 4
  • NEWBIE
  • 75 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 3
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 39
    Replies
Hi All,

I am trying to wrie a trigger so that once any account name is edited It should get all the related contacts of that account and send a few fields of those related contacts  as a webservice method to another class, i just need a proper trigger for this Please help me write this trigger, im done some as below but no working
trigger Contactcallout2 on Account(after update) {
Map<Id, Account> mapaccount = new Map<Id, Account>();
list<Contact> ListContact = new list<Contact>();
set<ID> accIds = new set<ID>();
for(Account acct : trigger.new) {
        acctIds.add(acct.Id);
        mapAccount.put(acct.Id, acct);
        }
        if(Name!=old.Name){
    listContact = [SELECT c.id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,c.accName,c.status__c AccountId FROM Contact WHERE AccountId IN : acctIds AND c.recordtypeID = '012D0000000BaFA'];
    }
       if(listContact.size() > 0) {
        for(Contact con : listContact) {
         WebServiceCallout.sendNotification(c.Id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,accName,c.status__c);
        }
        }
        }

Thanks
Abraham
Hi All,

I am using below Trigger code to send notifications to external webservice
if(Trigger.isUpdate){
        contact old = Trigger.oldMap.get(c.Id);
        if (c.Email != old.Email||c.FirstName!=old.FirstName||c.LastName!=old.LastName||c.phone!=old.phone||c.Title__c!=old.Title__c||c.status__c!=old.status__c||c.AccountID!=old.AccountID||c.Accounts__r.Name!=old.Account__r.Name)
but my error is only in the last part  c.Accounts__r.Name!=old.Account__r.Name i want the trigger to fire when the account name is edited Like for Example when Account name "SFDC" is edited to "SFDC.COM" the related contacts of the account is also changed to SFDC.COM. i want the trigger to fire when this name change occurs in the account name field of contact object that is the reason for adding this  c.Accounts__r.Name!=old.Account__r.Name  but it is not working giving me Compile Error: Invalid foreign key relationship: Contact.Accounts__r

Please help me resolve this issue.

Thanks
Abraham
Hi All,

I am getting this error on call out to the external database. Im sending data to external databse, Please help getting below error in debug log.
System.HttpResponse[Status=Bad Request, StatusCode=400]

Attached portion of code below:-
public class WebServiceCallout {

    @future (callout=true)
    public static void sendNotification(string Id,string Email,string First_Name,string Last_Name,string phone,string Title,string Account_name,string con_status) {
conweb cont=new conweb(Id,Email,First_Name,Last_Name,Phone,Title,Account_name,con_status);
list<conweb> conwebs=new list<conweb>();
conwebs.add(cont);
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
req.setTimeout(2000); // timeout in milliseconds
        req.setEndpoint('https://www.ext1234/api/user');
        req.setMethod('POST');
        req.setHeader('Content-Type','application/json');
        req.setHeader('Authorization','dasdsadee23442342r');
       req.setBody(JSON.serialize(conwebs[0]));
   try {
            if(!Test.isRunningTest())
                res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }

    }
Please help. 

Thanks
Abraham

 
Hi All,

Now I have contact records coming in from an external system into salesforce but when the contact is created in salesforce the Account which is a Lookup is creating duplicate values and not linked with the existing account, can anyone please let me know if an external id field can help resolve this issue?.
and like how the external id field identify the external system id and map it with SF id? Im not sure on how this works can anyone please shed some light?.

Please help.

Many Thanks
Abraham
im Getting  CUMULATIVE_LIMIT_USAGE at line 3 of this code
for(integer i = 0;i < eventIdsList.size(); i++){
    count = 0;
    for(Guest_New__c guest : existingGuestList ){
        if((guest.Event__c == eventIdsList[i]) && eventAndStatusValues.get(eventIdsList[i]).Contains(guest.Status__c)){
            count ++;
        }
    }
Please help to resolve this issue bit urgent.. Please let me know if more inputs required.

Below attached debug log details
16:27:12.347 (36347838249)|EXCEPTION_THROWN|[37]|System.LimitException: Apex CPU time limit exceeded
16:27:12.347 (36347939235)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.348 (36348089236)|CUMULATIVE_LIMIT_USAGE
16:27:12.348 (36348089236)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 4 out of 100
  Number of query rows: 26854 out of 50000 ******* CLOSE TO LIMIT
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 33 out of 10000
  Maximum CPU time: 15012 out of 10000 ******* CLOSE TO LIMIT
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 1 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:27:12.348 (36348089236)|CUMULATIVE_LIMIT_USAGE_END

16:27:12.348 (36348207142)|CODE_UNIT_FINISHED|TotalResponses on Guest_New trigger event AfterUpdate for [a0sD0000008ju0T, a0sD0000008jule, a0sD0000008jusR, a0sD0000008jvdu, a0sD0000008jwE2, a0sD0000008jxLq, a0sD0000008jyIu, a0sD0000008jyST, a0sD0000008jzkY, a0sD0000008k0Wy, a0sD0000008k14w, a0sD0000008k1sD, a0sD0000008k20q, a0sD0000008k2GF, a0sD0000008k3kC, a0sD0000008k4FZ, a0sD0000008k4Xx, a0sD0000008k4Zy, a0sD0000008k4r8, a0sD0000008k8qb, a0sD0000008k9iE, a0sD0000008kAEG, a0sD0000008kB8n, a0sD0000008kBIj, a0sD0000008kBp0, a0sD0000008kCYr, a0sD0000008kCb8, a0sD0000008kD5g, a0sD000000ApmVI, a0sD000000EstXy, a0sD000000Fr8Nf, a0sD000000GiAxg, a0sD000000LXsEf]
16:27:12.358 (36358504114)|DML_END|[20]
16:27:12.361 (36361896680)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.361 (36361931440)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.362 (36362032885)|CUMULATIVE_LIMIT_USAGE
16:27:12.362 (36362032885)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 34 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 33 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 1 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:27:12.362 (36362032885)|CUMULATIVE_LIMIT_USAGE_END

16:27:12.362 (36362143925)|CODE_UNIT_FINISHED|CopycontactAddressToguestAddress on Contact trigger event AfterUpdate for [0032000000CK502]
16:27:12.364 (36364104454)|EXECUTION_FINISHED



Thanks
Abraham
 
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.
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
Hi All,

I have the below trigger which when few field update happens to contact record it sends a webservice callout. Now i want it to send a webservice call out even when the contact is created in salesforce, can anyone please help me in modying this trigger such that it sends callout after record is newly created in salesforce also and not only on updation like it is currently doing. It should send callout during both update and create actions. Thanks!!
 
trigger Contactcallout on Contact (after update) {
Map<Id, String> m = new Map<Id, String>();
list<Contact> validContacts = new list<Contact>();
set<ID> accIds = new set<ID>();
for (contact c : Trigger.new) {
    if(c.RecordTypeId == '012D0000000BaFA'){
        contact old = Trigger.oldMap.get(c.Id);
         if (c.Email != old.Email||c.FirstName!=old.FirstName||c.LastName!=old.LastName||c.phone!=old.phone||c.Title__c!=old.Title__c||c.status__c!=old.status__c||c.AccountID!=old.AccountID)
         {
             validContacts.add(c);
                accIds.add(c.accountid);
         }
     }
}
map<ID, Account> accMap;
if(!accIds.IsEmpty()) // guard condition for SOQL
    accMap = new map<ID, Account>([select name from account where id in :accIds]);

for (contact c : validContacts) {
    Account acc = accMap.get(c.AccountID);
    string accName = acc == null ? null : acc.Name;
    WebServiceCallout.sendNotification(c.Id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,accName,c.status__c);
            
    
    }
}

Many thanks in advance
Abraham
Hi All,

Please can you help me with this. I want to Blacklist certain email domains so that users cannot create contacts with their personal email id. please can you help me on how this can be done.
Below are the listed email domains to blacklist how can we do this so that contact cant be created with the below (Email IDs)email domains.

@hotmail.com
@hotmail.co.uk
@outlook.com
@live.com
@aol.com
@gmail.com
@me.com
@yahoo.com
@ymail.co.uk

Many Thanksfor your help in advance.
Abraham
Please help me resolve this error, occuring at the below code line. how to overcome this 
Line no:3 is where the error occurs.
if(EventId != Null){
            event = [Select Id,Name from Event__c where Id =: EventId LIMIT 1];
            eventName = event[0].Name;
        }

Many Thanksin advance

Abraham



 
Hi all The below is the  area of error , i actually bring contacts to a custom object called event__c and then change these contacts to an other custom object called guest__c with a status associated to the event. now my problem is contacts should be added as guests to multiple events ie)1contact-->Many guests to multiple events. Now contact is getting converted/insert to guest only if it is not part of any event. i want it to convert to guest of an event even if its associated with any other event. how can changes made below to achieve below

Hope Im clear.. Many Thanks
 
public void addMembers()
    {
        try{
            guestList = new List<Guest_New__c>();
            set<ID> contactIds = new set<ID>();
            for(conWrapper cwrap : conWrapperList){
                contactIds.add(cwrap.objContact.id);
            }
            map<ID, guest_new__c> contToGuestMap = new map<ID, guest_new__c>();
            for(guest_new__C g : [select contact__c from guest_new__c where contact__c = :contactIds])
                contToGuestMap.put(g.contact__c, g);
            for(conWrapper cwrap : conWrapperList){           
                if(cwrap.checked == true){            
                    Guest_New__c objGuest = contToGuestMap.get(cwrap.objContact.Id);
                    if(objGuest == null){
                        objGuest = new Guest_New__c();
                        objGuest.Event__c = EventId;
                   }
                    
                    objGuest.Name = cwrap.Name;
                    objGuest.Email__c = cwrap.Email;
                    objGuest.FirstName__c = cwrap.fName;
                    objGuest.LastName__c = cwrap.lName;
                    objGuest.CompanyOrAccount__c = cwrap.objContact.Account.Name;
                    objGuest.Patch_Controller1__c = cwrap.Patchcontroller;
                    objGuest.Title__c = cwrap.objContact.Title;
                    objGuest.Status__c = statusVal;
                    objGuest.Contact__c = cwrap.objContact.Id;
                //    objGuest.Salutation__c = cwrap.objContact.Name.Salutation;
                //    objGuest.Guest_Address__r.Id = cwrap.objContact.Contact_Address__r.Id;                    
                    guestList.add(objGuest);
                }
            }
            if(guestList != Null && guestList.size() > 0){
                showMsg = true;
                messageStr = 'You have successfully added '+ guestList.size() + ' member(s).';
                ApexPages.addMessage(new ApexPages.message(ApexPages.severity.INFO,messageStr));
                system.debug('guestList >>>>>> '+guestList);
                upsert guestList;                
            }
            // logic to map contacts to guest
        }catch(DMLException e){
                system.debug('Insertion failed ' + e );
        }         
    }

 
I need to below code to give non array output currently it is sending a rest callout with []. i dont want the array [] just plain output {...}.. pls help to correct this code. it just needs to send the data without the brackets[]. Please help . Many Thanks!!
public class WebServiceCallout {

    @future (callout=true)
    public static void sendNotification(string Id,string Email,string First_Name,string Last_Name,string phone,string Title,string Account) {
conweb cont=new conweb(Id,Email,First_Name,Last_Name,Phone,Title,Account);
list<conweb> conwebs=new list<conweb>();
conwebs.add(cont);
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
req.setTimeout(2000); // timeout in milliseconds
        req.setEndpoint('http://requestb.in/1cwgm6y1');
        req.setMethod('POST');
        req.setHeader('Content-Type','application/json');
        req.setHeader('Authorization','gfkj^%$654GF65yhtd54');
       req.setBody(JSON.serialize(conwebs));
      

        try {
            res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }

    }

   
    
    
    public class conweb
    {
    String salesForceId;
    String emailAddress;
    String firstName;
    string lastName;
    string contactNumber;
    string jobTitle;
    string companyName;
   
    public conweb(string sid,string semail,string sfirstname,string slastname,string sphone,string Title,string Account)
    
    {
    salesForceId=sid;
    emailAddress=semail;
    firstName=sfirstname;
    lastName=slastname;
    contactNumber=sPhone;
    jobTitle=Title;
    companyName=Account;
  
    }
    }}

 
I have the below JSON POST callout class. The data is sent in an array format whereas the destination requires it in just normal format. please suggest to remove the array in this code an execute in normal format. Please help. I just want it to send data in normal format and not in an array.
 
public class WebServiceCallout {

    @future (callout=true)
    public static void sendNotification(string Id,string Email,string First_Name,string Last_Name,string phone,string Title,string Account) {
conweb cont=new conweb(Id,Email,First_Name,Last_Name,Phone,Title,Account);
List<conweb> conwebs=new List<conweb>();
conwebs.add(cont);
        HttpRequest req = new HttpRequest();
        HttpResponse res = new HttpResponse();
        Http http = new Http();
req.setTimeout(2000); // timeout in milliseconds
        req.setEndpoint('http://178.62.64.210/api/user');
        req.setMethod('POST');
        req.setHeader('Content-Type','application/json');
        req.setHeader('Authorization','gfkj^%$654GF65yhtd54');
       req.setBody(JSON.serialize(conwebs));
        //req.setBody('Id='+EncodingUtil.urlEncode(Id, 'UTF-8')+'&Email='+EncodingUtil.urlEncode(Email, 'UTF-8')+'&First_Name='+EncodingUtil.urlEncode(First_Name, 'UTF-8')+'&Last_Name='+EncodingUtil.urlEncode(Last_Name, 'UTF-8'));
        //req.setCompressed(true); // otherwise we hit a limit of 32000

        try {
            res = http.send(req);
        } catch(System.CalloutException e) {
            System.debug('Callout error: '+ e);
            System.debug(res.toString());
        }

    }

 
    
    
    public class conweb
    {
    String salesForceId;
    String emailAddress;
    String firstName;
    string lastName;
    string contactNumber;
    string jobTitle;
    string companyName;
   
    public conweb(string sid,string semail,string sfirstname,string slastname,string sphone,string Title,string Account)
    
    {
    salesForceId=sid;
    emailAddress=semail;
    firstName=sfirstname;
    lastName=slastname;
    contactNumber=sPhone;
    jobTitle=Title;
    companyName=Account;
  
    }
    }}

 
Hi All,

I want to send just one  field value to a application called 'cvent'  once this particular field gets updated in salesforce. So The Criteria is like  once i update this picklist field to a different value in salesforce it should update it in Cvent also so that both applications are in sync. Please can help me as to what is the best possible way to achieve this. I am kind of new to Integration. 

Any help highly Appreciated. Please can you help me out. Thanks!!
Hi all,

Pls let me know if the error in the below debug log. I am unable to save my controller class as it gives the below error:-
Compile Error: unexpected token: 'public with sharing class ITV_AddGuestToEventController ' at line 1 column 0
User-added image

The debug log is as below Please can you let me know what is the error here.
33.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO
13:49:24.019 (19842924)|EXECUTION_STARTED
13:49:24.019 (19876886)|CODE_UNIT_STARTED|[EXTERNAL]|VisualForce View State
13:49:24.026 (26649517)|CODE_UNIT_FINISHED|VisualForce View State
13:49:24.028 (28863710)|EXECUTION_FINISHED
13:49:24.966 (175779596)|CUMULATIVE_LIMIT_USAGE
13:49:24.966|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

13:49:24.966|CUMULATIVE_LIMIT_USAGE_END

Thanks!!

 
Hi all,
Can you pls help me with the below errors i am getting. I am just trying to replace a field with a different field in the VF page. I have made all the necessary changes in Controller and helper class but i get this error in the first line :- Compile Error: unexpected token: 'public with sharing class  at line 1 column 0 both controller and helper classs pls help.
User-added image
User-added image

Pls Help.. Thanks in advance.Any help is highly appreciated
Thanks!!
 
i am now having a requirement of integrating Cvent with salesforce. The users are using Cvent to create their Campaign templates and sends them to contacts. Now the reason for this integration is that it mainly needs the status of the contact when updated in cvent should be updated in salesforce and vice versa.i.e)The Invitee status as accepted or declined

Now the problem here is we are not using salesforce license, we are using force.com user license which do not have the standard campaign module, so we have build a custom campaign module and called it Event and Guest Functionality which is very similar to the standard campaign module, now first i know it is possible to do the integration with cvent with this force.com license and with the custom campaign module such that the status is updated at both ends.

i want to know how we can make this integration possible.
Please help me to achieve this and steps of what needs to be done to make this integration possible. 
Any help is much appreciated at the earliest. Thanks a lot in advance

Thanks&Regards
Abraham
Hi All,

I want to send just one  field value to a application called 'cvent'  once this particular field gets updated in salesforce. So The Criteria is like  once i update this picklist field to a different value in salesforce it should update it in Cvent also so that both applications are in sync. Please can help me as to what is the best possible way to achieve this. I am kind of new to Integration. 

Any help highly Appreciated. Please can you help me out. Thanks!!
i am now having a requirement of integrating Cvent with salesforce. The users are using Cvent to create their Campaign templates and sends them to contacts. Now the reason for this integration is that it mainly needs the status of the contact when updated in cvent should be updated in salesforce and vice versa.i.e)The Invitee status as accepted or declined

Now the problem here is we are not using salesforce license, we are using force.com user license which do not have the standard campaign module, so we have build a custom campaign module and called it Event and Guest Functionality which is very similar to the standard campaign module, now first i know it is possible to do the integration with cvent with this force.com license and with the custom campaign module such that the status is updated at both ends.

i want to know how we can make this integration possible.
Please help me to achieve this and steps of what needs to be done to make this integration possible. 
Any help is much appreciated at the earliest. Thanks a lot in advance

Thanks&Regards
Abraham
Hi All,

I am trying to wrie a trigger so that once any account name is edited It should get all the related contacts of that account and send a few fields of those related contacts  as a webservice method to another class, i just need a proper trigger for this Please help me write this trigger, im done some as below but no working
trigger Contactcallout2 on Account(after update) {
Map<Id, Account> mapaccount = new Map<Id, Account>();
list<Contact> ListContact = new list<Contact>();
set<ID> accIds = new set<ID>();
for(Account acct : trigger.new) {
        acctIds.add(acct.Id);
        mapAccount.put(acct.Id, acct);
        }
        if(Name!=old.Name){
    listContact = [SELECT c.id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,c.accName,c.status__c AccountId FROM Contact WHERE AccountId IN : acctIds AND c.recordtypeID = '012D0000000BaFA'];
    }
       if(listContact.size() > 0) {
        for(Contact con : listContact) {
         WebServiceCallout.sendNotification(c.Id,c.Email,c.FirstName,c.LastName,c.phone,c.Title__c,accName,c.status__c);
        }
        }
        }

Thanks
Abraham
Hi All,

I am using below Trigger code to send notifications to external webservice
if(Trigger.isUpdate){
        contact old = Trigger.oldMap.get(c.Id);
        if (c.Email != old.Email||c.FirstName!=old.FirstName||c.LastName!=old.LastName||c.phone!=old.phone||c.Title__c!=old.Title__c||c.status__c!=old.status__c||c.AccountID!=old.AccountID||c.Accounts__r.Name!=old.Account__r.Name)
but my error is only in the last part  c.Accounts__r.Name!=old.Account__r.Name i want the trigger to fire when the account name is edited Like for Example when Account name "SFDC" is edited to "SFDC.COM" the related contacts of the account is also changed to SFDC.COM. i want the trigger to fire when this name change occurs in the account name field of contact object that is the reason for adding this  c.Accounts__r.Name!=old.Account__r.Name  but it is not working giving me Compile Error: Invalid foreign key relationship: Contact.Accounts__r

Please help me resolve this issue.

Thanks
Abraham
Hi All,

Now I have contact records coming in from an external system into salesforce but when the contact is created in salesforce the Account which is a Lookup is creating duplicate values and not linked with the existing account, can anyone please let me know if an external id field can help resolve this issue?.
and like how the external id field identify the external system id and map it with SF id? Im not sure on how this works can anyone please shed some light?.

Please help.

Many Thanks
Abraham
im Getting  CUMULATIVE_LIMIT_USAGE at line 3 of this code
for(integer i = 0;i < eventIdsList.size(); i++){
    count = 0;
    for(Guest_New__c guest : existingGuestList ){
        if((guest.Event__c == eventIdsList[i]) && eventAndStatusValues.get(eventIdsList[i]).Contains(guest.Status__c)){
            count ++;
        }
    }
Please help to resolve this issue bit urgent.. Please let me know if more inputs required.

Below attached debug log details
16:27:12.347 (36347838249)|EXCEPTION_THROWN|[37]|System.LimitException: Apex CPU time limit exceeded
16:27:12.347 (36347939235)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.348 (36348089236)|CUMULATIVE_LIMIT_USAGE
16:27:12.348 (36348089236)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 4 out of 100
  Number of query rows: 26854 out of 50000 ******* CLOSE TO LIMIT
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 33 out of 10000
  Maximum CPU time: 15012 out of 10000 ******* CLOSE TO LIMIT
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 1 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:27:12.348 (36348089236)|CUMULATIVE_LIMIT_USAGE_END

16:27:12.348 (36348207142)|CODE_UNIT_FINISHED|TotalResponses on Guest_New trigger event AfterUpdate for [a0sD0000008ju0T, a0sD0000008jule, a0sD0000008jusR, a0sD0000008jvdu, a0sD0000008jwE2, a0sD0000008jxLq, a0sD0000008jyIu, a0sD0000008jyST, a0sD0000008jzkY, a0sD0000008k0Wy, a0sD0000008k14w, a0sD0000008k1sD, a0sD0000008k20q, a0sD0000008k2GF, a0sD0000008k3kC, a0sD0000008k4FZ, a0sD0000008k4Xx, a0sD0000008k4Zy, a0sD0000008k4r8, a0sD0000008k8qb, a0sD0000008k9iE, a0sD0000008kAEG, a0sD0000008kB8n, a0sD0000008kBIj, a0sD0000008kBp0, a0sD0000008kCYr, a0sD0000008kCb8, a0sD0000008kD5g, a0sD000000ApmVI, a0sD000000EstXy, a0sD000000Fr8Nf, a0sD000000GiAxg, a0sD000000LXsEf]
16:27:12.358 (36358504114)|DML_END|[20]
16:27:12.361 (36361896680)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.361 (36361931440)|FATAL_ERROR|System.LimitException: Apex CPU time limit exceeded

Trigger.TotalResponses: line 37, column 1
16:27:12.362 (36362032885)|CUMULATIVE_LIMIT_USAGE
16:27:12.362 (36362032885)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 2 out of 100
  Number of query rows: 34 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 1 out of 150
  Number of DML rows: 33 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 1 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

16:27:12.362 (36362032885)|CUMULATIVE_LIMIT_USAGE_END

16:27:12.362 (36362143925)|CODE_UNIT_FINISHED|CopycontactAddressToguestAddress on Contact trigger event AfterUpdate for [0032000000CK502]
16:27:12.364 (36364104454)|EXECUTION_FINISHED



Thanks
Abraham
 
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.
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