function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to change field values of lead using visualforce page and apex class ?

From custom button available on detail page I have to update lead record type, owner id. After changing these have to open detail page in edit mode.

We can not use process builder because page can not be opened in edit mode.

How this can be done using visualforce page.

What would be the contents of visualforce page and apex class ?
Nithesh NNithesh N

Although, I am not a big fan of it. This functionality can still be achieved through declarative programming though URL Custom Button. 

you see, The basic template i follow for url hacking for stuff like this is as follows.


https://{org}/{object Prefix}/e?{ID field1}={some value}&{ID field2}_lkid={value}&retURL=/{some third ID field}
There is a good tutorial here (, which will help you in getting your work done. But if you still want to do it with Visualforce let me know.