FetchXML Notes

Link Entities

When retrieving attributes from linked entities it seems that attributes must have an alias otherwise you can’t refer to them:

<fetch distinct='false' mapping='logical' aggregate='false'>
<entity name='productpricelevel'>
<attribute name='amount'/>
<attribute name='transactioncurrencyid'/>

<link-entity name='product' from='productid' to='productid'>
<attribute name='transactioncurrencyid' alias='producttransactioncurrencyid'/>
<attribute name='price' alias='price'/>
<attribute name='productid' alias='productid'/>
</link-entity>

</entity></fetch> 

Updating FetchXML Reports

According to this article, http://www.magnetismsolutions.com/blog/paulnieuwelaar/2011/12/18/Run_Fetch_XML_Report_on_Selected_Record_in_Dynamics_CRM_2011.aspx you should not upload an .rdl file into an existing report because the context in which the report is run is not changed.

Referring to Aliased Values for lookups

(AliasedValue)a.Attributes[“producttransactioncurrencyid”]

(EntityReference) ( aliasedvalue ).Value

(Guid)( entityreference ).Id  // to get record id

(string) ( entityreference ).Name // to get the name of the primary attribute of the record

Leave a Comment

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