User Review
( votes)In our previous blog, we looked into basic configurations for extending the Schedule Board functionalities by adding various types of Controls within the Filter Panel, which filters the Bookable Resources based on the filter conditions.
There can be various complex scenarios where we have to customize the Dynamics 365 Field Service Schedule board, in this blog we can go through the configuration of the Schedule Board for complex link entities within Filter Layout Queries.
In Dynamics 365 Field Service, the Dispatcher uses the Schedule board to allocate the Bookable Resource for specific Resource Requirements to work on the same, and the Dispatcher must assign the Resource item to the appropriate Resources on the field. Currently, Field Service has a specific set of OOB filters within the Filter Panel of the Schedule Board to filter out the Resources, but in some, the business scenario will require having the resources filtered out based on attributes of related Account, User, etc. So, this can be achieved using customizations within the Unified Fetch XML queries i.e. Retrieve Resource Query, Filter Layout Query of the Schedule Board Setting.
This blog will go through the steps to configure these kinds of conditions for Resource Filtration on the Schedule board.
For Example, we will consider a scenario where on the schedule board we have to Filter Resources based on below conditions:
- Filter Pricelist for Bookable Resources if the Resource Type is Account.
- Add filter for Resource Score of Bookable Resources if the Resource Type of Account.
Let’s explore the configuration for Universal Fetch XML Queries to customize the Schedule board with the above-mentioned requirement in Dynamics 365 Field Service.
1. Navigate to the respective Schedule Board >> Board Setting and edit the “Filter Layout” Query with the below tag to add the Lookup control for Pricelist selection in the Filter Layout Panel.
Please refer to the below screenshot for the same.
<control type="combo" source="entity" key="Pricelist" label-id="Resource Pricelist" entity="pricelevel" multi="true" />
2. Similarly, for Resource Score (custom field on the Account) will add control for Resource Score optionset selection in the Filter Layout Panel.
Please refer to the below screenshot for the same.
<control type="combo" source="optionset" key="ResourceScore" label-id="Resource Score" entity="account" attribute="custom_resourcescore" multi="true" > <data> <value id="483050000" /> <value id="483050001" /> <value id="483050002" /> <value id="483050003" /> </data> </control>
3. Now we have to add the Link Entity conditions for filter conditions which will filter out the resources based on the below conditions:
- Filter Pricelist if the Resource Type is Account.
- Add filter for Resource Score if the Resource Type of Account.
For these conditions will have to add the Link Entity for Account of the Resource from Bookable Resource Booking within “Retrieve Resource Query” as shown below:
<link-entity name="account" from="accountid" to="accountid" link-type="inner" ufx:if="$input/Pricelist | $input/ResourceScore"> <attribute name="accountid" alias="accountid" groupby="true"/> <attribute name="entityimage_url" alias="accountimagepath" groupby="true"/> <attribute name="name" alias="AccountName" groupby="true"/> <attribute name="custom_resourcescore" alias="custom_resourcescore" groupby="true" /> <!--Resource pricelist--> <filter type="and"> <condition operator="in" attribute="defaultpricelevelid" ufx:if="$input/Pricelist/bag"> <ufx:apply select="$input/Pricelist/bag"> <value> <ufx:value select="@ufx-id" /> </value> </ufx:apply> </condition> <!--Resource Score--> <condition attribute=" custom_resourcescore" operator="in" ufx:if="$input/ResourceScore/bag/option"> <ufx:apply select="$input/ResourceScore/bag/option"> <value> <ufx:value select="." /> </value> </ufx:apply> </condition> </filter> </link-entity>
Please find below comments for the highlighted ufx: if tags:
- ufx:if=”$input/Pricelist | $input/ResourceScore”: This UFX tag in the link entity tag defines that this link entity condition applies only if the Pricelist or ResourceScore control in the Filter Layout Panel has values, otherwise this filter will not be applied.
- ufx:if=”$input/Pricelist/bag”: As per our requirement we have to check two attribute values within the same Link Entity of Account, one for Price List and one for Resource Score. Therefore, in order to define the Pricelist attribute condition, we have to add this ufx: if tag.
- ufx:if=”$input/ResourceScore/bag/option”: Similarly, for the Resource Score condition, this tag will define this condition and will only be applied if the Resource Score control has values on the Filter Panel.
Let’s see the result of our customizations on the schedule board with scenarios:
a. Filter Pricelist as Retail on Resources having Resource Type as Account.
b. Filter Resources with Resource Score as Good.
b. Combination of Resource Score and Pricelist filter conditions.
Conclusion
In this way, we can configure complex conditions with link entities to filter out the suitable Bookable Resources on the Schedule Board.