I have a canvas app which uses the REST API to access salesforce data and I want to define/use a custom field on the Lead object. I found out how to add custom fields via the web interface via Customize -> Leads -> Fields, but I want to be able to do this programatically so that I can use the field for anyone that installs the app. As I understand it the REST API cannot do this and I will need to use the Metadata API.

Is the Metadata API the best/easiest way to define a custom field for use by my app?, If so can I authenticate with it using the signed request that Salesforce POSTs to my canvas app?, Finally can anyone point me to a simple example of how I might add a custom field using the Metadata API, ive looked into it a bit and im not exactly sure how it is supposed to work.

  • Possible you might find this slideshow of use: Integrating Web Apps with Force.com Canvas
    – blunders
    May 25, 2014 at 16:50
  • 2
    This seems like a bit of an odd thing to do. A more typical approach would be to create a managed package that includes the definition of the custom field required by your canvas app. By installing this managed package the target org gets both components together. May 25, 2014 at 20:40
  • that sounds perfect! I didnt know I could put something like that into a managed package, as you might be able to tell im new to this salesforce app thing :), If you make this as an answer ill accept it
    – user8246
    May 25, 2014 at 21:51

1 Answer 1


As per my comment...

A more common approach here is to create a managed package that will include the definiton of both the canvas connected app and the custom fields it requires.

Any Org that installs the package will also get the field required by the custom app.

You must log in to answer this question.

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