Edit a schedule board resource cell

Completed

You can customize and extend the schedule board to help you reach your business needs.

Consider the following customization scenario:

You can assign and book a bookable resource to a project. Due to various factors, discrepancies can occur between the booked and assigned hours against a bookable resource. A resource manager wants such discrepancies highlighted on the board. In this scenario, you'll apply the following customizations to the resource cell to show:

  • Total booked hours

  • Total assigned hours

  • A green tick in the cell if the numbers match or a red cross if the numbers differ

In the current scenario, a given resource will receive all booked and assigned hours in the system, which will include historical data. This approach will help keep the scenario simple. In a real-life scenario, you might want to only get the relevant booked/assigned hours that are related to the current projects. You might also filter the data so that only upcoming hours are shown in the cell. You can achieve this goal by using Microsoft Power Automate. In this scenario, you'll use rollup fields to roll up the hours.

For more information, see Bookings vs. assignments.

In this exercise, you'll add rollup columns to the Bookable resource table, modify the resource query, and update the cell template on the schedule board.

For more information, see Create a rollup field to aggregate values the new columns to the bookable resource table, follow these steps:

  1. From Microsoft Power Apps maker portal, select the correct environment.

  2. Go to Solutions > Default Solution > Tables > Bookable Resource > Columns and then add two new columns with the following details.

    Total booked hours column properties

    Property Value
    Display Name Total Booked Hours
    Data type Decimal
    Behavior Rollup
    Required Optional
    Schema name new_TotalBookedHours
    Logical name new_totalbookedhours
    Rollup field configuration
    Source entity Bookable Resource
    Use hierarchy No
    Related entity Project Team Members (Bookable Resource)
    Filters If Status equals "Active"
    Aggregation Sum of Hard Booked Hours

    Total assigned hours column properties

    Property Value
    Display Name Total Assigned Hours
    Data type Decimal
    Behavior Rollup
    Required Optional
    Schema name new_TotalAssignedHours
    Logical name new_totalassignedhours
    Rollup field configuration
    Source entity Bookable Resource
    Use hierarchy No
    Related entity Project Team Members (Bookable Resource)
    Filters If Status equals "Active"
    Aggregation Sum of Total Effort (Hours)
  3. Add the newly created columns to the form to administer your resources.

  4. Publish the changes.

Create a new schedule board (or modify an existing one)

Go to the schedule board where you want to add the new columns. The following screenshot shows an example schedule board titled Customized Board. Areas will be highlighted on the schedule board that you'll customize with the new columns.

Screenshot that shows how you customize the cell template to show the booked and assigned hours along with an icon to visually represent a mismatch between the two values.

Modify the resource query

To retrieve the new columns on the board, you'll need to modify the default query that's associated with the board. You can do so from the Board settings panel, which you can access by selecting the ellipsis (...) next to the board name in the toolbar and selecting Board settings.

  1. In the Board settings panel, go to Other > Retrieve resource query.

  2. Create a new resource query named Customized Retrieve Resources Query by using Retrieve Resource Query as the source. You can do so by opening the existing default query and selecting the Save As button in the editor.

    From the settings panel, go to others and add a new resource query by clicking the plus icon.

    The existing code is lengthy, so the following code snippets are the only ones that you'll need to paste within an existing resource query.

  3. After this line:

    <attribute name="msdyn_organizationalunit" alias="msdyn_organizationalunit" groupby="true" />

    Paste the following lines:

    <attribute name="new_totalassignedhours" alias="new_totalassignedhours" groupby="true" />
    
    <attribute name="new_totalbookedhours" alias="new_totalbookedhours" groupby="true" />
    

Use the following image for reference.

Edit retrieve resources query. Add the two custom attributes to the query below the msdyn_organizationalunit statement.

Modify the resource cell template

You'll create a new Resource cell template named Customized Resource Cell Template from Board settings > Other > Resource cell template > Add New. Paste the following code into the editor and then save the settings. You might need to refresh the board to view the changes.

<div
    class='resource-card-wrapper {{iif ResourceCellSelected "resource-cell-selected" ""}} {{iif ResourceUnavailable "resource-unavailable" ""}} {{iif IsMatchingAvailability "availability-match" ""}}'>
    {{#if (or (eq (is-sa-grid-view) true) (eq (is-row-small) false)) }}
    {{#if imagepath}}
    <img class='resource-image' role='presentation' alt='' src='{{client-url}}{{imagepath}}' />
    {{else if isPool}}
    <div class='resource-image pool-resource'></div>
    {{else if isCrew}}
    <div class='resource-image crew-resource'></div>
    {{else}}
    <div class='resource-image unknown-resource'></div>
    {{/if}}
    {{/if}}
    <div class='resource-info'>
        <div class='resource-name primary-text ellipsis' title='{{name}}'>{{name}}</div>
        <div class='secondary-text ellipsis'>
            {{#if (and (eq (is-sa-grid-view) false) (eq (is-row-small) false)) }}
            {{#if ResourceAllocation}}
            <div class='resource-allocation'>{{ResourceAllocation}}</div>
            {{else}}
            {{#if (eq new_totalbookedhours new_totalassignedhours) }}
            <i class="fa fa-check" aria-hidden="true" style="color:#22c55e"></i>
            {{else}}
            <i class="fa fa-times" aria-hidden="true" style="color:#ef4444"></i>
            {{/if}}
            <div class='booked-duration'>
                {{#if new_totalbookedhours}}
                ({{new_totalbookedhours}}h booked)<div class='fo-sch-clock'></div>
                {{else}}
                (0h booked)<div class='fo-sch-clock'></div>
                {{/if}}
            </div>
            <div class='booked-duration'>
                {{#if new_totalassignedhours}}
                ({{new_totalassignedhours}}h assigned)<div class='fo-sch-clock'></div>
                {{else}}
                (0h assigned)<div class='fo-sch-clock'></div>
                {{/if}}
            </div>
            <div class='booked-percentage'>{{BookedPercentage}}%</div>

            {{/if}}
            {{additional-capacity-button false 40 55}}
            {{/if}}
        </div>
        {{additional-capacity-button true 55 605 }}
        {{#if (eq (is-sa-grid-view) false) }}
        <div class='matching-indicator'></div>
        {{/if}}
    </div>
    {{additional-capacity-button false 0 40}}
    {{#if (eq (is-sa-grid-view) false) }}
    {{> resource-map-pin-template this }}
    {{/if}}
</div>

Now, the green tick or red cross should show against each resource when you expand the resource details by selecting the plus (+) button. Refer to the previous section for an example preview of the output.