Skip to main content

Notifications

Dynamics AX 365 insert not allowed for field ‘XXXX'”,”type”:”System.InvalidOperationException”

Amir Nazim Profile Picture Amir Nazim 5,994

I was working on creating the new Data entity related to Case Details on Dynamics ax 365, The creation went well and simple. when i tried to consume the new Data entity from odata client using c#, i got this exception.

An error occurred while processing this request.{
“error”:{
“code”:””,”message”:”An error has occurred.”,”innererror”:{
“message”:”insert not allowed for field ‘CaseId'”,”type”:”System.InvalidOp
erationException”,”stacktrace”:” at Microsoft.Dynamics.Platform.Integration.Se
rvices.OData.Update.UpdateProcessor.CreateEntity_Save(ChangeOperationContext con
text, ChangeInfo changeInfo)\r\n at Microsoft.Dynamics.Platform.Integration.Se
rvices.OData.Update.ChangeInfo.ExecuteActionsInCompanyContext(IEnumerable`1 acti
onList, ChangeOperationContext operationContext)\r\n at Microsoft.Dynamics.Pla
tform.Integration.Services.OData.Update.ChangeInfo.TrySave(ChangeOperationContex
t operationContext)\r\n at Microsoft.Dynamics.Platform.Integration.Services.OD
ata.Update.UpdateManager.SaveChanges()\r\n at Microsoft.Dynamics.Platform.Inte
gration.Services.OData.AxODataBatchHandler.<ExecuteRequestMessagesAsync>d__10.Mo
veNext()”
}
}
}

This error is related to CaseId field on Case Details, after enough investigation i found that validatefield method from corresponding table is being fired and not allowing manual insertion on CaseId field. As this field is Number sequence bound. But our requirement was to create the case using custom value provided from Odata client using c#.

After enough research i got the clue to skip the table level validation from data entity. So i have decided to modify the data entity and override following methods and skip the table level validation for the CaseId field.

Thanks

Amir- Happy daxing


This was originally posted here.

Comments

*This post is locked for comments