3

I have created a app and have it as package and have install to an another env i have a custom button in may package. I need to get this button auto generated on the object when the package get installed. Now the button has get generated but the admin need to customize the page layout then need to add button.

My need is to create a auto generate button on the object when package is installed so that admin is not need to customize page layout.

2 Answers 2

2

Our developers have been successful in developing some Salesforce Admin tools that automatically manipulate the Layout metadata via the Metadata API via Apex. The only requirement is that the Admin add a Remote Site setting. After that they use a VF UI we provide in the package (via the package Configuration link). This UI can perform any Salesforce admin operation that can be performed via the Metadata API.

In your case your VF page will need to retrieve the Layout information, modify it using Apex XML features to add the button and deploy a new version. You can see a Retrieve and Deploy demo here that shows how to perform the basics of these operations. As stated above you could package this into a Configuration UI for you package.

enter image description here

https://github.com/financialforcedev/apex-mdapi

Example of the Configuration button on a Package.

enter image description here

1
  • He's asking for "without intervention." I like your solution, and I'd probably do that for my own project (via the "configuration" link on the managed package).
    – sfdcfox
    Commented Jul 13, 2013 at 14:46
0

Have you created the custom button on the object? You can do that by going to the object and creating the button itself along with spelling out the details of where you want it point to. Similarly, you can also create a replacement page for the object you want the button to go on (I realize it could go on a completely different object). That page could also be included as part of your package.

For an example of this, you may want to look at Implementing the Mass Update Status Button in Chapter 11 of Force.com Platform Fundamentals where a button is created on the status field of the Candidate Object and placed in the Job Applications Related list of the Positions page. This links the 3 Objects together both with standard and custom VF pages.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

2
  • I think he also wants to add this button on to the page layout too, without admin intervention.
    – Sai
    Commented May 10, 2013 at 14:56
  • If he includes the page in his package, that's what I'd expect that he'd be doing. However, since he might be trying to replace an existing page that he can't overwrite, they might need to enable his new page for him. If its a totally new page that's simply part of his package that works under one of his tabs, I wouldn't expect it to be a problem. It would seem to ultimately depend on how the metadata in his install package is set-up, but that's a bit beyond my experience level.
    – crmprogdev
    Commented May 10, 2013 at 15:25

You must log in to answer this question.

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