Friday, April 10, 2015

Salesforce Partner/Enterprise SOAP API QuickStart - Part 1: Setting Up Your WSDL

Using the Salesforce SOAP API in .NET is not straight forward there are a few quirks from the normal way you use SOAP.  You can either follow your way through some of my gotchas or you can bypass all that and use the Salesforce SOAP API QuickStart Module available by emailing me at

To obtain the enterprise SOAP API WSDL you need to log into as the administrator.  Once you have done that you can scroll down and on the left hand side you will see the developer menu.  Click on it.

If it scrolled you to the top scroll down and note that the develop menu is now opened. Click on the API option.
There are a few APIs listed.  The Enterprise API is specific to your organization.  It can save you some time as it will know some things about your environment but most likely you want the Partner API as you can then share your code or modules with others who work for different organizations.  I will generate using the Partner API but the generation will be similar for Enterprise.

Once it generates you will see the an xml and get excited and rush off to take the Url and use it in Visual Studio as the WSDL.  Don't Rush off so soon as it will not work. You will get this error:

There was an error downloading '$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: ''.
The content type text/html;charset=UTF-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 597 bytes of the response were: '
The reason being that the WSDL is secured.  You can see it in the browser because you are logged into however Visual Studio is NOT logged in.  To get around this.  Right Click on the page and click Save As

Save the WSDL on the file system in a place your Visual Studio Project can access it. Now in your Visual Studio Project choose Add Service Reference

Now in the reference box put the path to the xml file you saved for the WSDL then click Go.  Once You will see in the services box that the api has loaded

NOTE: If you are using .NET 2.0 then you may get an error in the WSDL related to the date fields. Thanks Alex for the information below:

There is a parsing issue when using .NET 2.0 with date time fields in salesforce, accessing through web services.
It seems to be a bug in .NET but there's another way to address it by manually editing the wsdl.
More information here:
 Enter a namespace for your service and click OK

The next step is to download the Force.Com Cookbook. This will provide you with what you need to get started such as login/logout and searching.

If you have questions or would like a copy of the Salesforce SOAP API QuickStart Module email me at This module is free to use the only thing I as is if you add new functionality to it or fix any issues in it that you send me the changes so I can share them with others using the module.

Thursday, April 9, 2015

SalesForce World Tour

There is a lot of buzz about the SalesForce World Tour #SalesForceTour on twitter as it is in Boston today.  There are a lot of good sessions and you will get to meet a lot of people currently working with Salesforce.

If you are in Toronto and have not registered please do at: Salesforce World Tour Toronto

Look forward to seeing you all there.

Contact Roles is not showing up on my Account Details page

Thanks Scott Jorgensen for the advice on Contact Roles :)

Contact Roles are very useful in a number of situations:

  1. You want to track companies a person used to work for. That way if you are looking for a contact at a company and cannot find them. You may be able to contact someone who used to work there and get a contact that way maybe even an introduction.
  2. You have people who work for a given company but sit on the a board or counsel or some other relationship.
  3. They could be a member of organizations like ToastMasters, or other organizations.
They are available out-of-the-box however are not displayed on the accounts page by default.  To add them to the accounts page you must do the following:  
  1. Log in as someone with access to edit the Account Layout.
  2. Navigate to an account details page.
  3. Click on Related Lists

  4. Drag and drop Contact Roles onto your layout

  5. Click Save

Now on your account details page you can add Contact Roles to your contacts.  If you need additional Contact Roles you can add them you by doing the following:

  1. Click Setup at the top right
  2. On the left column click on Customize -> Accounts -> Contact Roles

  3. Add your roles here.

If you have any tips, tricks or resources you would like to share with the guild please email me at