FetchXML to get the Bookable Resource vs there Sales Price

You can use the below code to get the bookable resource and its sales price.

FetchXML Code

<fetch version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”true”>
<entity name=”bookableresourcebooking”>
<attribute name=”starttime” />
<attribute name=”resource” />
<attribute name=”endtime” />
<attribute name=”duration” />
<attribute name=”msdyn_projectid” />
<attribute name=”bookingtype” />
<attribute name=”bookingstatus” />
<attribute name=”bookableresourcebookingid” />
<order attribute=”starttime” descending=”true” />
<filter type=”and”>
<condition attribute=”bookingstatus” operator=”ne” uiname=”Canceled” uitype=”bookingstatus” value=”{0ADBF4E6-86CC-4DB0-9DBB-51B7D1ED4020}” />
<condition attribute=”duration” operator=”ne” value=”0″ />
<condition attribute=”msdyn_projectid” operator=”not-null” />

<condition attribute=”starttime” value=”@sd” operator=”on-or-after”/>
<condition attribute=”endtime” value=”@ed” operator=”on-or-before”/>

</filter>

<link-entity name=”msdyn_project” from=”msdyn_projectid” to=”msdyn_projectid” link-type=”inner” alias=”cy”>
<link-entity name=”msdyn_resourcerequirement” from=”msdyn_projectid” to=”msdyn_projectid” link-type=”inner” alias=”cz”>
<attribute name=”cf_role” />
<filter type=”and”>
<condition attribute=”cf_role” operator=”ne” uiname=”Non-Billable” uitype=”bookableresourcecategory” value=”{93807AC5-176A-E811-A963-000D3A81E302}” />
</filter>

<link-entity name=”bookableresourcecategory” from=”bookableresourcecategoryid” to=”cf_role” link-type=”inner” alias=”da”>
<link-entity name=”msdyn_resourcecategorypricelevel” from=”msdyn_resourcecategory” to=”bookableresourcecategoryid” link-type=”inner” alias=”r_price”>
<attribute name=”msdyn_priceinprimaryunit_base”/>
<attribute name=”msdyn_priceinprimaryunit”/>
<attribute name=”msdyn_price”/>
<attribute name=”transactioncurrencyid”/>
<filter type=”and”>
<condition attribute=”msdyn_organizationalunit” operator=”eq” uiname=”CloudFronts” uitype=”msdyn_organizationalunit” value=”{95E73D37-0A6A-E811-A964-000D3A81EAE4}” />
</filter>

<link-entity name=”pricelevel” from=”pricelevelid” to=”msdyn_pricelist” link-type=”inner” alias=”ep”>
<attribute name=”name”/>
<attribute name=”createdon”/>

<order attribute=”createdon” descending=”true” />

<link-entity name=”msdyn_orderpricelist” from=”msdyn_pricelist” to=”pricelevelid” link-type=”inner” alias=”price_list” >
<attribute name=”msdyn_pricelist” />
</link-entity>
</link-entity>
</link-entity>
</link-entity>
</link-entity>
<link-entity name=”salesorderdetail” from=”msdyn_project” to=”msdyn_projectid” link-type=”inner” alias=”dc”>
<attribute name=”msdyn_billingmethod”/>
<filter type=”and”>
<condition attribute=”msdyn_billingmethod” operator=”eq” value=”192350000″ />
</filter>
<link-entity name=”salesorder” from=”salesorderid” to=”salesorderid” link-type=”inner” alias=”fr” >
<attribute name=”name”/>
</link-entity>
</link-entity>
</link-entity>
</entity>
</fetch>

Also: if you want to see it in the advanced find, attached is the screenshot how it will look.

role price

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s