4

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!

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

1 Answer 1

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.

2
  • 2
    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? Commented Jun 30, 2015 at 23:05
  • It would be nice to have an example of how we can add custom fields via a package and how we can alter the layout of a standard object (where those custom fields are added to). Are permission sets required for this? How about Apex classes? Commented Sep 27, 2024 at 15:16

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.