{"title":"Using Properties Indicate the Presence of a Value in a Field","url":"https://jonas-paprotka.de/docs/dev-itpro/webservices/use-properties-to-indicate-field-value/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/use-properties-to-indicate-field-value, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/webservices/use-properties-to-indicate-field-value","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Using properties with Visual Studio to indicate the presence of a value in a field.","date":"2021-04-01","meta":{"topic":"concept-article"},"outline":[{"level":1,"title":"Using Properties Indicate the Presence of a Value in a Field","slug":"using-properties-indicate-the-presence-of-a-value-in-a-field","at":0,"chars":3585},{"level":2,"title":"Using Properties to Indicate the Presence of Values","slug":"using-properties-to-indicate-the-presence-of-values","at":519,"chars":3066},{"level":3,"title":"Example","slug":"example","at":3362,"chars":223}],"text":"# Using Properties Indicate the Presence of a Value in a Field\nWhen you set a field to a value in the code for a web service client and then send the value back to the web service, such as when you use the create-operation or the update-operation, the field value is not actually updated to anything other than its default value. This issue can occur if you are using proxies that are generated by Visual Studio or the tools in the .NET Framework SDK. This topic describes the issue and shows how to avoid the problem.\n## Using Properties to Indicate the Presence of Values\nThe problem occurs because of the way proxies are auto-generated and the way the .NET Framework handles values in XML documents that are exchanged between the web service and the client. The issue is not specific to Business Central.\nFor example, the following code shows the schema for the two fields on this Customer Card web service:\n```xml\n<xsd:element minOccurs=\"0\" maxOccurs=\"1\" name=\"Credit_Limit_LCY\" type=\"xsd:decimal\" />\n<xsd:element minOccurs=\"0\" maxOccurs=\"1\" name=\"Salesperson_Code\" type=\"xsd:string\" />\n```\nBoth fields are optional, which means that they do not have to be present in the XML document. One field is declared as a Decimal data type in Business Central. The other field is a string because it is declared as a Text data type in Business Central.\nIf both values are present, then the XML document should contain the following elements:\n```xml\n<Credit_Limit_LCY>1000</Credit_Limit_LCY>\n<Salesperson_Code>JR</Salesperson_Code>\n```\nBut if there is no information about the credit limit, then the document should contain the following element:\n```xml\n<Salesperson_Code>JR</Salesperson_Code>\n```\nIf the credit limit is zero, then the document should contain the following line:\n```xml\n<Credit_Limit_LCY>0</Credit_Limit_LCY>\n```\nFor the decimal type and all .NET Framework value types, you can handle this state in the proxy objects by using a Boolean *Specified property:\n```csharp\nif (salesOrder.Credit_Limit_LCYSpecified)\n    there is a value present in salesOrder.Credit_Limit_LCY\nelse\n    there is no useful value in salesOrder.Credit_Limit_LCY\n```\nIf you assign a non-default value in the value type, then you should confirm this by setting the accompanying Boolean *Specified property to true:\n```csharp\nsalesOrder.Credit_Limit_LCY = 1000;\nsalesOrder.Credit_Limit_LCYSpecified = true;\n```\nTo specify that there is no meaningful value in the salesOrder.Credit_Limit_LCY value type, set the accompanying Boolean *Specified property to false:\n```csharp\nsalesOrder.Credit_Limit_LCYSpecified = false;\n```\nThe value in the salesOrder.Credit_Limit_LCY value type will now be disregarded.\n.NET Framework reference types, such as the String class, are handled differently because .NET Framework declarations that are based on those types can be null, which means that they can have an explicit expression of no value present:\n```csharp\nif (salesOrder.Salesperson_Code != null)\n    there is a value present in salesOrder.Salesperson_Code\nelse\n    there is no value in salesOrder.Salesperson_Code\n```\nIf you assign a value, then you implicitly also define it as present:\n```csharp\nsalesOrder.Salesperson_Code = \"JR\";\n```\nTo specify that there is no useful value in salesOrder.Salesperson_Code, you should set it to null:\n```csharp\nsalesOrder.Salesperson_Code = null;\n```\n### Example\n```csharp\nSalesOrder salesOrder = new SalesOrder();\nsalesOrder.Order_Date = DateTime.Today;\nsalesOrder.Order_DateSpecified = true;\nsalesOrder.Currency_Code = \"SEK\";\n\nsalesOrderService.Create(ref salesOrder);\n```"}