Create a Dynamic Detail Page Button For Any sObject using Meta Data

Core to the Salesforce infrastructure, Metadata is what makes the magic happen!

Metadata is a lightweight language based on XML. In Salesforce, metadata represents the structure of salesforce.com and Force.com development elements.

Basically, they are the core components or features that relate to the structure of objects and their fields, configurations, logic, code, and page layouts which build your look, feel, and the information architecture of your Salesforce Org. Instead of the traditional development approach, you can import metadata into your Salesforce Org and modify it in the product interface. This is super fast and immediately available through any web browser and there are no downsides to it

Where can you use it?

The change applies to Lightning Experience and Salesforce Classic in Essentials, Professional, Enterprise, Performance, Unlimited, and Developer editions.|

Steps to Dynamic Detail Page Button for any sObject:

  • Enter the name of the Button.
  • Select the sObject which you want to Create Button.
  • Hit the button “Create custom Button Link
  • A button with the label “Save” will be created in the Account Object.
create dynamic page button

Output:-

create dynamic page button

Step 1: To do this, let's start off with a super simple controller. Create Apex class

“CreateCustomButtonLink”

Step 2: Create another apex class “MetadataService”

Step 3: Create Visualforce Page

Conclusion

This simple yet effective method will help you create a dynamic detail page button for the sObject of your choice using Metadata. Try it out and if you come up with any queries regarding this, do reach out!

Our Location worldwide
India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
SR Tower 2nd Floor Hydel Gate Haldwani Uttarakhand 263126 +91-5946359996
USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada
HIC Global Solutions INC
43 Lafferty Lane, Richmond Hill, L4C 3N8, CA +1(262) 310-7818