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

Attempt to de-reference a null object in visualforce page
public without Sharing class SendToContractorController {
Public Account newAccount {get; set;}
Public String AccountId ;
Public String eventType ;
Public ApexPages.StandardController controller {get; set;}
public SendToContractorController() {
AccountId = ApexPages.currentPage().getParameters().get('Id');
eventType = ApexPages.currentPage().getParameters().get('type');
}
public PageReference init() {
try{
if(eventType == 'SentToCustomer') {
newAccount.Sent_to_Customer__c = true;
// newAccount.Subcontractor_Email__c = newAccount.Subcontractor_Search__r.Applicant2_Email__c ;
update newAccount;
// SendToContractorController.processEvent(new set<Id>{newAccount.id});
PageReference eventPage = new ApexPages.StandardController(newAccount).view();
eventPage.setRedirect(true);
return eventPage;
} else if(eventType == 'SyncDataFromCustomer') {
List<Contractor_Job__c> contractorJobList = [SELECT Id, Event_Id__c, Start_Date_Time__c,End_Date_Time__c,Description__c, Status__c, Recharge_Notes__c, Special_Instructions__c
FROM Contractor_Job__c
];
system.debug('contractorJobList::'+contractorJobList);
SyncSubcontractorData.syncData(contractorJobList);
PageReference eventPage = new ApexPages.StandardController(newAccount).view();
eventPage.setRedirect(true);
return eventPage;
}
} catch(Exception e){
ApexPages.addMessages(e);
}
return null;
}
Public Account newAccount {get; set;}
Public String AccountId ;
Public String eventType ;
Public ApexPages.StandardController controller {get; set;}
public SendToContractorController() {
AccountId = ApexPages.currentPage().getParameters().get('Id');
eventType = ApexPages.currentPage().getParameters().get('type');
}
public PageReference init() {
try{
if(eventType == 'SentToCustomer') {
newAccount.Sent_to_Customer__c = true;
// newAccount.Subcontractor_Email__c = newAccount.Subcontractor_Search__r.Applicant2_Email__c ;
update newAccount;
// SendToContractorController.processEvent(new set<Id>{newAccount.id});
PageReference eventPage = new ApexPages.StandardController(newAccount).view();
eventPage.setRedirect(true);
return eventPage;
} else if(eventType == 'SyncDataFromCustomer') {
List<Contractor_Job__c> contractorJobList = [SELECT Id, Event_Id__c, Start_Date_Time__c,End_Date_Time__c,Description__c, Status__c, Recharge_Notes__c, Special_Instructions__c
FROM Contractor_Job__c
];
system.debug('contractorJobList::'+contractorJobList);
SyncSubcontractorData.syncData(contractorJobList);
PageReference eventPage = new ApexPages.StandardController(newAccount).view();
eventPage.setRedirect(true);
return eventPage;
}
} catch(Exception e){
ApexPages.addMessages(e);
}
return null;
}
You can use system.debug() statements in your controller code to show you values being returned at different stages.