I believe cardRequest
is the primary culprit in this issue. It is the record object.
Why does my save function not save and create a record of the page I am trying to save?
public PageReference Save() {
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);
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Error,ex.getMessage()));
isSaveSuccessful = false;
}
return ret;
}