1
votes

I am using the SalesForce Partner API, not the Enterprise API. I want to be able to programatically (C#) add a custom field to any object in SalesForce (as an External ID) so I can merge data from external systems into the SalesForce object. I know there is a way to do this with the MetaData API, but I've also seen a number of references that suggest it's possible through the Partner API, which would be far better because we don't need to spin up yet another API connection to achieve this.

There seems to be no information about this anywhere. I can't find anything on the SalesForce.com help website or anywhere else on the internet and although mentioned in other posts, it doesn't appear that anybody has posted information about how to do it, or not that I can find anyway.

Can anybody point me in the right direction? Some sample code or a link to an article somewhere describing how to do it?

Thanks very much.

1
You can't define new custom fields using the partner API.superfell

1 Answers

2
votes

Since you need to create a custom field - which is metadata - only Metadata API can help you.

I am not sure what you mean by "to spin up yet another API connection" - but you can use Metadata API in the same service IMHO. Just get the Metadata WSDL and consume it. All your other calls with the partner api remain the same.

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_calls_intro.htm

https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_quickstart_java_sample.htm