I am having a hard time understanding whybelieve cardRequest
is the primary culprit in this issue. It is the record object.
Why does my save function will not save and create a record of the page I am trying to save. If anyone has an Idea or critique of this function please feel free to leave your responses. Thank you in advance.?
public PageReference Save() {
//cardRequest.Staff_Member__c = staffMember.Name;
//cardRequest.Requestor__c = requestor == null ? staffMember.Name : requestor.Name;
System.SavePoint sp = Database.setSavepoint();
PageReference ret;
try {
if (cardRequest.ID != NULL) {
stdController.save();
ret = new PageReference('/' + Business_Card_Request__c.getSObjectType().getDescribe().getKeyPrefix());
ret.setRedirect(true);
}
else {
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'Object is NULL*'));
isSaveSuccessful = false;
}
}
catch (System.DMLException ex) {
Database.rollback(sp);
System.Debug(ex);
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,ex.getMessage()));
isSaveSuccessful = false;
}
return ret;
}
Also cardRequest is the primary culprit in this. It is the record object.