Hello folks,
do you have me maybe a tipp what is wrong in my POST SOAP request if I am trying to create a new account via the IOrganizationService/Execute? I want to fill in only two fields on the newly created account:
a. Standard field: name
b. Custom field: ap_accountrole that is a multiOptionSet field (supported from version 9.0), here you can see more about the field:
but I always get the following error message as Response:
Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails.
The statement has been terminated.'
The CRM version is 1710 9.1.0.876 online
Do you have any idea why it is not working correctly and as expected? Is the syntax wrong? Does the old Org.Service not longer support this new feature of CRM 9.x?
I'd really appreciate any hints from the community.
Thank you in advance!
Regards,
Norbert
My SOAP Request was:
POST: <validName>.api.crm4.dynamics.com/XRMServices/2011/Organization.svc/web Header: Authorization Bearer <validToken> SOAPAction schemas.microsoft.com/.../Execute Content-Type text/xml; charset=utf-8 <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="schemas.xmlsoap.org/.../envelope"> <s:Body> <Execute xmlns="schemas.microsoft.com/.../Services" xmlns:i="www.w3.org/.../XMLSchema-instance"> <request i:type="a:CreateRequest" xmlns:a="schemas.microsoft.com/.../Contracts"> <a:Parameters xmlns:b="schemas.datacontract.org/.../System.Collections.Generic"> <a:KeyValuePairOfstringanyType> <b:key>Target</b:key> <b:value i:type="a:Entity"> <a:Attributes> <a:KeyValuePairOfstringanyType> <b:key>name</b:key> <b:value i:type="c:string" xmlns:c="www.w3.org/.../XMLSchema">Account_CPQ_Test_20181209194131</b:value> </a:KeyValuePairOfstringanyType> <a:KeyValuePairOfstringanyType> <b:key>ap_accountrole</b:key> <b:value i:type="c:OptionSetValueCollection" xmlns:c="schemas.microsoft.com/.../Contracts"> <c:OptionSetValue> <a:Value>778210000</a:Value> </c:OptionSetValue> </b:value> </a:KeyValuePairOfstringanyType> </a:Attributes> <a:EntityState i:nil="true" /> <a:FormattedValues xmlns:b="schemas.datacontract.org/.../System.Collections.Generic" /> <a:Id>00000000-0000-0000-0000-000000000000</a:Id> <a:LogicalName>account</a:LogicalName> <a:RelatedEntities /> </b:value> </a:KeyValuePairOfstringanyType> </a:Parameters> <a:RequestId i:nil="true" /> <a:RequestName>Create</a:RequestName> </request> </Execute> </s:Body> </s:Envelope>
And the response with error message looks:
Header: x-ms-service-request-id 33c367c2-effa-4fd9-a45e-30511f15c8a0 REQ_ID 33c367c2-effa-4fd9-a45e-30511f15c8a0 Content-Length 14462 Cache-Control private Content-Type text/xml; charset=utf-8 Date Thu, 13 Dec 2018 10:11:11 GMT Set-Cookie ApplicationGatewayAffinity=0dba0a79351f5b72d2eea63a5bcb63ad64f2c424fed5c36a5468a13cb6f69a5b;Path=/;Domain=<OrgName>.api.crm4.dynamics.com Server <?xml version="1.0" encoding="utf-8"?> <s:Envelope xmlns:s="schemas.xmlsoap.org/.../envelope"> <s:Body> <s:Fault> <faultcode>s:Client</faultcode> <faultstring xml:lang="en-US">Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated.'</faultstring> <detail> <OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance"> <ActivityId>45beaf84-edb0-4cab-aa54-f8b5b483a882</ActivityId> <ErrorCode>-2147204784</ErrorCode> <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic"> <KeyValuePairOfstringanyType> <a:key>ApiExceptionSourceKey</a:key> <a:value i:type="b:string" xmlns:b="www.w3.org/.../XMLSchema">Plugin/Microsoft.Crm.Common.ObjectModel.AccountService</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiOriginalExceptionKey</a:key> <a:value i:type="b:string" xmlns:b="www.w3.org/.../XMLSchema">Microsoft.Crm.CrmException: Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated.' ---> Microsoft.Crm.CrmException: Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated.' ---> System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Crm.CrmDbConnection.LockConnectionAndExecuteMethod[TResult](IDbConnection connection, Func`1 executeMethod) at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command) at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass110_0.<InternalExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Platform.Server.DataEngine.SqlDataAccessManager.<>c__DisplayClass2_0.<ExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.BusinessEntities.MultiSelectOptionValuesTrigger.DoCreate(Guid id, MultiSelectOptionsInfo info) at Microsoft.Crm.BusinessEntities.MultiSelectOptionValuesTrigger.Create(Guid id) at Microsoft.Crm.BusinessEntities.TriggersExtension.ExecuteTriggers(BusinessEntity entity, ArrayList triggers, OperationType operationType) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostCreateEventHandler.Invoke(Object sender, ExtensionEventArgs e) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.<>c__DisplayClass167_0.<Create>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Common.ObjectModel.AccountService.Create(IBusinessEntity entity, ExecutionContext context) --- End of inner exception stack trace --- --- End of inner exception stack trace --- at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context) at Microsoft.Crm.Extensibility.PipelineInstrumentationHelper.Execute(Boolean instrumentationEnabled, String stopwatchName, ExecuteWithInstrumentation action, PipelineExecutionContext context) at Microsoft.Crm.Extensibility.Pipeline.<>c__DisplayClass2_1.<Execute>b__0()</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiStepKey</a:key> <a:value i:type="b:guid" xmlns:b="schemas.microsoft.com/.../Serialization">ffc9bb1b-ea3e-db11-86a7-000a3a5473e8</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiDepthKey</a:key> <a:value i:type="b:int" xmlns:b="www.w3.org/.../XMLSchema">1</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiActivityIdKey</a:key> <a:value i:type="b:guid" xmlns:b="schemas.microsoft.com/.../Serialization">45beaf84-edb0-4cab-aa54-f8b5b483a882</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiPluginSolutionNameKey</a:key> <a:value i:type="b:string" xmlns:b="www.w3.org/.../XMLSchema">System</a:value> </KeyValuePairOfstringanyType> <KeyValuePairOfstringanyType> <a:key>ApiStepSolutionNameKey</a:key> <a:value i:type="b:string" xmlns:b="www.w3.org/.../XMLSchema">System</a:value> </KeyValuePairOfstringanyType> </ErrorDetails> <Message>Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated.'</Message> <Timestamp>2018-12-13T10:11:11.3721858Z</Timestamp> <ExceptionRetriable>false</ExceptionRetriable> <ExceptionSource i:nil="true" /> <InnerFault> <ActivityId>45beaf84-edb0-4cab-aa54-f8b5b483a882</ActivityId> <ErrorCode>-2147204784</ErrorCode> <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" /> <Message>Sql error: 'Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated.'</Message> <Timestamp>2018-12-13T10:11:11.3721858Z</Timestamp> <ExceptionRetriable>false</ExceptionRetriable> <ExceptionSource i:nil="true" /> <InnerFault> <ActivityId>45beaf84-edb0-4cab-aa54-f8b5b483a882</ActivityId> <ErrorCode>-2147220970</ErrorCode> <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" /> <Message>Exception output:: System.Data.SqlClient.SqlException (0x80131904): Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.Crm.CrmDbConnection.LockConnectionAndExecuteMethod[TResult](IDbConnection connection, Func`1 executeMethod) at Microsoft.Crm.CrmDbConnection.InternalExecuteWithRetry[TResult](Func`1 ExecuteMethod, IDbCommand command) at Microsoft.Crm.CrmDbConnection.<>c__DisplayClass110_0.<InternalExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Platform.Server.DataEngine.SqlDataAccessManager.<>c__DisplayClass2_0.<ExecuteNonQuery>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.BusinessEntities.MultiSelectOptionValuesTrigger.DoCreate(Guid id, MultiSelectOptionsInfo info) at Microsoft.Crm.BusinessEntities.MultiSelectOptionValuesTrigger.Create(Guid id) at Microsoft.Crm.BusinessEntities.TriggersExtension.ExecuteTriggers(BusinessEntity entity, ArrayList triggers, OperationType operationType) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.PostCreateEventHandler.Invoke(Object sender, ExtensionEventArgs e) at Microsoft.Crm.BusinessEntities.BusinessProcessObject.<>c__DisplayClass167_0.<Create>b__0() at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties) at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func) at Microsoft.Crm.Common.ObjectModel.AccountService.Create(IBusinessEntity entity, ExecutionContext context) ClientConnectionId:1ada3058-636e-40fe-b05e-2e96427c89c8 Error Number:515,State:2,Class:16 ClientConnectionId before routing:9dd1a11a-f8f4-4b97-9c05-a8a636eb8fbf Routing Destination:dcc1f4abba56.tr18.northeurope1-a.worker.database.windows.net,11138 Error(s) details: Class: 0x10 LineNumber: 1 Message: Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. Number: 515 Procedure: Server: dcc1f4abba56.tr18.northeurope1-a.worker.database.windows.net,11138 Source: .Net SqlClient Data Provider State: 2 ToString(): System.Data.SqlClient.SqlError: Cannot insert the value NULL into column 'SelectedOptionValues', table 'db_crmcoreemea_20180909_07491506_4bcc.dbo.MultiSelectAttributeOptionValuesBase'; column does not allow nulls. INSERT fails. -- Class: 0x0 LineNumber: 1 Message: The statement has been terminated. Number: 3621 Procedure: Server: dcc1f4abba56.tr18.northeurope1-a.worker.database.windows.net,11138 Source: .Net SqlClient Data Provider State: 0 ToString(): System.Data.SqlClient.SqlError: The statement has been terminated. -- : Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #A29A4BCD</Message> <Timestamp>2018-12-13T10:11:11.3731844Z</Timestamp> <ExceptionRetriable>false</ExceptionRetriable> <ExceptionSource i:nil="true" /> <InnerFault i:nil="true" /> <OriginalException i:nil="true" /> <TraceText i:nil="true" /> </InnerFault> <OriginalException i:nil="true" /> <TraceText i:nil="true" /> </InnerFault> <OriginalException i:nil="true" /> <TraceText i:nil="true" /> </OrganizationServiceFault> </detail> </s:Fault> </s:Body> </s:Envelope>








