Ways of redirecting to standard edit page of object from the vf page onclick of your custom button if we want to fetch the record id

Ways of redirecting to standard edit page of object from the vf page onclick of your custom button if we want to fetch the record id -


//lightning/mobile

if( (typeof sforce != 'undefined') && sforce && (!!sforce.one) ) {

    // Salesforce app navigation

    sforce.one.editRecord(​recordId);

}

else {

// Set the window's URL using a Visualforce expression

    window.location.href = '{!URLFOR($Action.Lead.Edit, recordId)}';

}


Reference -

https://developer.salesforce.com/docs/atlas.en-us.234.0.pages.meta/pages/salesforce1_dev_jsapi_sforce_one.htm

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/vf_dev_best_practices_pages_multipurpose.htm

Comments