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. Accessto 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 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;
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 = CRM60.update("company", CRMBase);
}