• sail away
  • NEWBIE
  • 0 Points
  • Member since 2011

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

I am making a google api call and I am getting the above exception. There is no DB call made before or after ....

 

public PageReference save() {


List<Event> passUpdateEvt = new List<Event>();


for(Event crud : event){
system.debug('selectedGoogle'+ crud.selectedGoogle__c);
if (crud.selectedGoogle__c)
{

passUpdateEvt.add(new Event(subject = crud.Subject,
description = crud.Description,
startdatetime = crud.StartDateTime,
enddatetime = crud.enddatetime,
location = crud.location));



}
// this makes a call to the google api error is raised with the 

//System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out 

 

//Class.GoogleService.getFeedMethod: line 184, column 15 Class.GoogleService.makePostRequest: line 84, column 3 //Class.CalendarService.updateEventBatch: line 227, column 9 Class.GooglePullController.save: line 475, column 13 //External entry point

 

 


service.updateEventBatch(cal, passUpdateEvt);
}




PageReference pgref = new PageReference('/apex/CustomTabTest');
pgref.setRedirect(true);
return null;
}

I am getting the following errors

Trigger.FindOrCreateContact_Trigger: line 7, column 13
  caseAssignmentUpdateTest.caseAssignmentTest System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, FindOrCreateContact_Trigger: execution of AfterInsert

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.FindOrCreateContact_Trigger: line 7, column 13
  ContractClass.testCaseCreation System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, FindOrCreateContact_Trigger: execution of AfterInsert

caused by: System.NullPointerException: Attempt to de-reference a null object

 

My trigger Code:

 


Code:
trigger FindOrCreateContact_Trigger on Case (after insert) {
    Map<ID,Contact> contactMap;
    Map<Id, String> csMap;
    for (Case newCase:System.Trigger.new)
    {
        if(newCase.contactid == null){
            csMap.put(newCase.Id, newCase.Suppliedemail);             
            //Map<ID, Contact> m = new Map<ID, Contact>([Select id, c.email from Contact c WHERE email IN emails]);
        }
    }
    contactMap = new Map<ID, Contact>([select id, email from contact WHERE email IN :csMap.values()LIMIT 1]);
    for(Case updateCase: Trigger.new){
        if(csMap.containsKey(updateCase.id)){
            for(Contact c: contactMap.values()){
                if (updateCase.SuppliedEmail == c.Email) {
                    updateCase.ContactID = c.ID;
                }
            }
        }
    }
}

 

 

 

  • January 28, 2009
  • Like
  • 0