pythonhttpdynamics-crmfetchxml

fetchxml does not reuturn column in dynamics


I am using Python to send a http GET request to extract the contacts associated with a segment. The segment for example called "Test Segment" which has a unique identifier "a1-b2-c3".

Below is a fetchXML query I am using:

<fetch mapping="logical" output-format="xml-platform" version="1.0" page="1" count="5000" paging-cookie=""> 
  <entity name="contact"> 
  <attribute name="fullname"/> 
  <attribute name="contactid"/> 
  <attribute name="emailaddress1"/> 
  <attribute name = "btp_contacttypeid"/>
  <order attribute="fullname" descending="false"/> 
  <link-entity name="msdyncrm_segment" from="msdyncrm_segmentid" to="msdyncrm_segmentmemberid" alias="bb"> 
  <attribute name="msdyncrm_segmentname" />
  <filter type="and"> 
  <condition attribute="msdyncrm_segmentid" operator="eq" uitype="msdyncrm_segment" value="a1-b2-c3"/>
  </filter>
  </link-entity>
  </entity>
  </fetch>

I get the following output:

_odata_etag fullname contactid emailaddress1 btp_contacttypeid
W/"83" Adam Jame xxxxx adam@test.com 742e3888

I believe fetchXML automatically removes the null values columns. Technically it is not null but not sure why it returns null Expected Output:

_odata_etag fullname contactid emailaddress1 btp_contacttypeid msdyncrm_segmentname
W/"83" Adam Jame xxxxx adam@test.com 742e3888 Test Segment

Can you please help with the following problem?


Solution

  • This problem occurs in two diffrent scenario

    1. Permissions to field
    2. Null Value

    When you execute query over dynamics crm sdk, attribute with null value does not exist in entity. Same problem occurs when user does not have a permission to field.