3

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.

Thanks!

  • 1
    Why use the metadata api to add the fields? How often do you expect the fields to change? – martin Jun 23 '15 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 Jun 23 '15 at 14:21
  • 2
    Have you considered putting your fields in a (managed) package that your customers can download? – martin Jun 23 '15 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 Jun 23 '15 at 16:42
2

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 Jun 30 '15 at 23:05

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.