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 3
  • 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 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.

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);


  • How would you go about setting dates as null?

  • Please see

  • Dear Jeff,

    We are working on updating selection field to null via (SOAP) Web services in Sage CRM v7.3 b.

    We have created one custom entity in Sage CRM using .Net API entity wizard and also enabled Web services for the same. We have tried above code for Text and Integer fields and found that it is working as expected. However we are trying the same for Selection fields then it does not update null value in database.

    We have even checked above code for Standard Entities like Case, Company etc. but we are getting same behavior. Initially we thought it may be an issue with patch; however we found same results in v7.2 and v7.3 with different patches.

    Any help in this regards would be appreciated.