Found an integer attribute with unrecognized format: new_customeridtype – Solved

By | November 2, 2016

Introduction:

Microsoft introduced the customer type field in Dynamics CRM 2016. To know more about it, you can refer this blog to explore it more. In this blog, we will focus on one of the error, which is caused while retrieving entity metadata for customer field.

Problem:

In one of our examples, our requirement was to read the metadata of entity. For this, we tried to retrieve entity metadata using RetrieveEntityRequest.

Following is the code snippet:

//Retreive the entity request
                RetrieveEntityRequest attreq = new RetrieveEntityRequest();
                //retrieve all data for an entity
                attreq.EntityFilters = EntityFilters.All;
                //set the custom entity logical Name
                attreq.LogicalName = "new_employee";
                //Set this value to true to include unpublished changes, as it would look if you called publish
                attreq.RetrieveAsIfPublished = true;
                //Response the request RetreiveEntityRequest
                RetrieveEntityResponse attResponse = (RetrieveEntityResponse)_service.Execute(attreq);

While execution, it was throwing the error “Found an integer attribute with unrecognized format: new_customeridtype”.

Cause:

RetrieveAsIfPublished = “True” means return the metadata(Entity, Attributes, Relationship, Optionset, option) including unpublished changes.

RetrieveAsIfPublished = “False” means return only the currently published Metadata, ignoring any unpublished changes.

In order to overcome with this issue, we set entity request “RetreiveAsIfPublished” property to false.

Solution:

So we used the revised code as below:

//Retreive the entity request
                RetrieveEntityRequest attreq = new RetrieveEntityRequest();
                //retrieve all data for an entity
                attreq.EntityFilters = EntityFilters.All;
                //set the custom entity logical Name
                attreq.LogicalName = "new_employee";
                //Set RetrieveAsIfPublished value to false ignoring the unpublished changes
                attreq.RetrieveAsIfPublished = false;
                //Response the request RetreiveEntityRequest
                RetrieveEntityResponse attResponse = (RetrieveEntityResponse)_service.Execute(attreq);

And, we were able to get the results without any error.

Hope this helps you.

Get hands on experience of Maplytics – Dynamics CRM + Maps and navigate with style!

Leave a Reply

Your email address will not be published. Required fields are marked *