Home SALESFORCEAPEX How to return a PageReference to create a sObject in salesforce

 How to return a PageReference to create a sObject in salesforce

Using Static:
PageReference ref =  new PageReference(‘/a00/e’);

Using SObject:
public PageReference customObjectPageReference() {
Schema.DescribeSObjectResult R = YourCustomObject__c.SObjectType.getDescribe();
// Add /o to end of URL to view recent
return new PageReference(‘/’ + R.getKeyPrefix() + ‘/e’);
}

You may also like

Leave a Comment