1
votes

I am writing a simple PlugIn for Dynamics CRM 2011 which should retrieve a custom attribute which I customized in the pricelist entity.

When I execute the following code, all standard attributes are returned, but not the one custom attribute which I customized (and published of course). I don't get an error, but simply the attribute 'axi_submarketid' is not returned. If I read data from a completely custom entity, I have no problem.

        string fetch = string.Format(@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
          <entity name='pricelevel'>
            <attribute name='name' />
            <attribute name='transactioncurrencyid' />
            <attribute name='enddate' />
            <attribute name='begindate' />
            <attribute name='statecode' />
            <attribute name='pricelevelid' />
            <attribute name='axi_submarketid' />
            <order attribute='name' descending='false' />
            <filter type='and'>
              <condition attribute='pricelevelid' operator='eq' uiname='10 Stromlieferung' uitype='pricelevel' value='{0}' />
            </filter>
          </entity>
        </fetch>", pricelevelid);

        EntityCollection pricelevel = _service.RetrieveMultiple(new FetchExpression(fetch));

What am I doing wrong?

Thanks for help, Peter

1

1 Answers

1
votes

I solved my issue myself and it is a bit embarassing :-)

The expected attribute was not deliverd, because it had no content. Meaning, not only in the direct context of a PlugIn, but also when requesting data in general: if in an attribute there is no data, the attribute is not sent back, for example if the attribute is NULL or has no value in it.

Thanks anyway, hope this question and answer helps someone else.

Regards, Peter