I'm currently using the Salesforce REST API to send data from our client app to our users' Salesforce accounts. While some of our data fits into the stock fields of a Lead object, we will also require custom fields to add more unique data points.

While I've read that it is only possible to add custom fields via the Metadata API, I have yet to see any good examples - or even a simple explanation of what an API request should look like. The closest I've come to an explanation is the answer to this question, however it points to Apex code and not a generic set of instructions of how to add custom fields to standard objects via the Metadata API.

This leads me to ask two questions:

  1. Is this even possible? Can I add custom fields to standard Lead objects on behalf of our users?
  2. What's the best way to do this? I read a lot about the WSDL, but I'm not sure how to use that or the Metadata API. I'm attempting to do this in Go, but any clear examples would be helpful.


  • 1
    Why use the metadata api to add the fields? How often do you expect the fields to change?
    – martin
    Commented Jun 23, 2015 at 14:18
  • Not often, but I need to add them for users' accounts as they grant our web service access to their Salesforce account. I can't ask each user to go manually add these fields for us, but maybe there is a better way that I'm missing?
    – user387049
    Commented Jun 23, 2015 at 14:21
  • 2
    Have you considered putting your fields in a (managed) package that your customers can download?
    – martin
    Commented Jun 23, 2015 at 14:28
  • @martin I hadn't heard of packages, managed or otherwise, before. After testing with one custom field it looks like it's going to work perfectly, thanks! If you want to post your comment as an answer I'm more than happy to accept it.
    – user387049
    Commented Jun 23, 2015 at 16:42

1 Answer 1


When an app requires certain fields to be present in Salesforce, a good option to consider is putting the fields into a package that users can download.

  • 1
    When users install our package, the custom fields we are adding to their standard objects do not show up by default. Do you know if there is an easy way to make this the case?
    – user387049
    Commented Jun 30, 2015 at 23:05

You must log in to answer this question.

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