2

I have a package which deploy some functionality to organization and to be completely installed I need to add custom button to quote layout. As I know - there is no way to add custom button from Apex, but we can do it calling metadata API. And here is another problem I can call metadata API from trusted IP address or I should use security token. Obviously, I do not have security token at package installation time and the only way - add IP address to trusted. Is there unobtrusive way I can do that during installation?

3

If the user installing the application has API access then you can certainly call Metadata API provided you create Remote site settings.

The visualforce merge field or userinfo.getsessionId() can be used to extract session Id .

The first step can be creation of Remotesitesettings followed by API callout .

You can also Use pure JS Ajax callout to invoke Metadata API if you do not want to use apex metadata API wrapper.

1

I have faced the same problem in my project. You can achieve this by:

  • Add the API in the remote site.
  • Define a apex class which implements the InstallHandler
  • Use this class as post install script for the package.
  • In this class make the meta data api callout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.