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
khillan bhardwajkhillan bhardwaj 

Creating custom button by using Apex code like trigger or apex class

hello all,

              i want to create custum button by using apex class. i know rarely it possible. but i have such require ment . i can create custom button for standard button and add then in package . but in oganization in which package installed may have a number of custum object in which i want to add custom button on detail page . if there is any pssiblity to create custom button by apex code plz let me know


thanks & Regards

khillan singh


This page has a great walkthrough of how to acheive this using a custom button that redirects to a VF page with an onLoad action:


Otherwise you could think about using JavaScript behind your button to call the class.


Have you got the solution for your requirement, I need to do the same.. can you help me on this.