Sage CRM 2020: How do you set a null value via (SOAP) Web Services?

Assuming that Values are passed as strings via webservices we can therefore represent null as an empty string.

The code below is modified extract of code from the Web Services Test Harness that I use in my training classes. If I want to set the comp_website address field to null I only need to pass in an empty string. In the database this will be saved as a null.

Note:  You can find the latest version of the test harness here:  https://community.sagecrm.com/partner_community/m/example_components__developer_resources/default.aspx

ewarebase[] CRMBase;
updateresult CRMUpdateResult;
try
{
CRMBase = new ewarebase[1];
CRMCompany.companyid = int.Parse(textboxComp_Companyid.Text);
CRMCompany.companyidSpecified = true;
CRMCompany.name = textBoxComp_Name.Text;
//CRMCompany.website = textBoxComp_WebSite.Text;
CRMCompany.website = "";
CRMCompany.source = comboBox1.Text;
CRMBase[0] = CRMCompany;
CRMUpdateResult = CRM.update("company", CRMBase);
}

In my C# project I can either receive the 'null' from the screen

CRMCompany.website = textBoxComp_WebSite.Text;

Or I can set the null in my code

CRMCompany.website = "";

Either way this results in the actual XML passed to the server will be the same.

Note: I have assumed the setting "Dropdown fields as strings in WSDL file:Yes".

Anonymous