How do you set a null value via (SOAP) Web Services?

Partner Community

Partner Community
This Group is for Sage CRM Business Partners and members of the Sage CRM Developer Program. Access to much of the material here is restricted according to your membership profile.

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

How do you set a null value via (SOAP) Web Services?

  • Comments 2
  • Likes

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 sixthapp on the DPP site that is used in the 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.

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