Adding Fields to an Outbound Message & Web Service
Tags: salesforce, webservice, outboundmessage, soaprequest
Published: 2019-03-08 17:44:34

---
title: Adding Fields to an Outbound Message & Web Service
published: true
description: Part three of my three part Salesforce series - I walk the reader through adding more fields to the Salesforce Outbound Message and WCF Web Service they created in parts 1 and 2.
tags: Salesforce, Web Service, Outbound Message, SOAP Request
series: Salesforce SOAP API Services
---

Welcome to Part 3 of my Salesforce Outbound Messages Series! In this tutorial I am going to teach you how to add more fields to your Outbound Message and Web Service for cases where you've built out your connection and realize you actually needed more fields than your original WSDL contained. This is important because we used svcutil to replace the contents of our Interface class with that of our Salesforce WSDL instead of importing it within Visual Studio. This means we have no Web or Service Reference and must update our Interface class manually and thankfully this isn't too difficult.

At this point I'm going to assume that you have an Outbound Message set up in Salesforce, a .NET WCF Web Service that compiles, and a "True" Ack notificationsResponse when you connect with them using a PutsReq bucket.

---

The first step is updating Salesforce with your new fields. Navigate to your Salesforce Outbound Message, click Edit, and add the fields you need from the Available Fields. Click Save when you've finished.

![Salesforce Outbound Message](https://thepracticaldev.s3.amazonaws.com/i/8c2fnnk3fos3fo7i3fm7.PNG)

Use the link to generate a new WSDL (you don't need to save it). You should now see your new fields with the original AccountId element, you will want to note whether they are nillable and what their type is because we will be using these values in our service.

![WSDL Elements](https://thepracticaldev.s3.amazonaws.com/i/m8mize5jmgj9x34uj6od.PNG)

Open your Web Service project and add the new fields to your Interface class where partial class Quote inherits from sObject. It will look something like the code below:

![Interface Class Code](https://thepracticaldev.s3.amazonaws.com/i/66trj3e7ur7qjby0ui0i.PNG)

Create or use an existing PutsReq bucket for your Outbound Message endpoint URL, then create a new Quote in Salesforce. <i>Remember to update the Order XML field if your Workflow Rule checks for changes in this field!</i> The Outbound Message will still fail, as we do not have a real connection, but PutsReq will give us the POST Soap Envelope which we can use in one of two ways:
1. Paste the entire Soap Envelope into a SOAP UI Request and click Submit
    ![SOAP Request](https://thepracticaldev.s3.amazonaws.com/i/x1v7uy33zvngw7j5pejr.PNG)
2. Paste each field from the Soap Envelope into your Web Service WCF Test Client
    ![WCF Test Client Request](https://thepracticaldev.s3.amazonaws.com/i/73e4mhihetx4emt79w1f.PNG)

Whichever method you choose, you should receive a True Ack notificationsResponse for Salesforce to be happy.

---

The final step in this process is the most individualized - you will need to get your Web Service online and make it accessible from outside of your organization's security and firewall. You must also build the functionality into your Web Service to use and manipulate the fields you've passed in depending on what you use them for. There will not be a Part 4 covering this portion; I leave this endeavor up to your own curiosity. Happy coding!