1

Is there a way to show/Invoke the salesforce standard edit record from the VF page?

I'm using DataTables to show the list of Tasks which is a Custom object, and I want to show up on the salesforce edit screen on click to edit the record.

enter image description here

Can anyone please help me to implement this feature?

1 Answer 1

1

You can use these two ways of redirecting to standard edit page of lead from your vf page onclick of your custom button if you are fetch the record id:-

// If you are in 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)}';
}

References:-

  1. Navigation and Messaging with the sforce.one Object
  2. Creating Visualforce Pages That Work in Mobile and Desktop
4
  • Thank you Sanket it worked. also is there a way to refresh the Vf page after we Save the record?
    – Chandu
    Commented Apr 11, 2022 at 10:08
  • you can use sforce.one.back(​[refresh]) to refresh. check here Commented Apr 11, 2022 at 11:20
  • Hello Sanket, sorry for delay in my response. I'm using the sforce.one.back(true) as below but its not refreshing after save. can you please correctly what is wrong in my code.
    – Chandu
    Commented Apr 28, 2022 at 14:21
  • Sanket, here is what I'm doing if ( typeof (id) == 'string' && taskassignfieldresp.keyPrefix == id.substring(0,3)) { sforce.one.editRecord(id); } else { sforce.one.createRecord("dftlytime__TT_Task_Assignment__c"); } sforce.one.back(true);
    – Chandu
    Commented Apr 28, 2022 at 14:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .