Search This Blog

Wednesday 27 September 2017

Resolved: The field with ID '21' does not exist in table 'smmContactPersonEntityCopy'.

One day one of my Integration Teams was trying to insert records from CRM to Dynamics 365 for Operations using the integration tool i,e Logic apps.

There logic app was configured correctly and they were successfully able to fetch the records from CRM but when they were trying to insert the records in D365 for operations they were getting the following error:

 "An error has occurred.  Error executing code: The field with ID '21' does not exist in table 'smmContactPersonEntityCopy'.\r\nclientRequestId: 4f0ca82f-ff64-46a9-9066-ff62cea0b036" 

I investigated the issue in D365 for operations.Actually they copied the standard AX entity i,e ContactPersonEntity to create the new one smmContactPersonEntityCopy.

I created the job with in D365 for operations to insert the records into the same entity.















After running the above job I was also getting the same error that I have stated above.After some  debugging I found out that the error was on the init value method of my entity i.e

smmContactPersonEntityCopy.initValue();

 When I looked into that method and found out that it was throwing exception on number sequence generation.








After some analysis I found out that the other developer has copy the standard AX entity i.e smmContactPersonEntity and created new Entity with ame smmContactPersonEntityCopy and he forgot to update the refrences in code.

So as you can see in the above image Its smmContactPersonEntity I have change this to smmContactPersonEntityCopy and after that I rebuild the project and I run my job which was successfully able to insert the records in that entity and my logic app was also working fine.

Below is the updated code:





Thanks
Zahid.