web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Updating Bookable Resource Booking set Field Service Status using Patch with Power Apps canvas app

(0) ShareShare
ReportReport
Posted on by 5

Hi everyone,

I have a Power Apps canvas app, which has a gallery of Bookable Resource Bookings.

The app has a 'Change Status' button and I need this to update the Field Service Status using a Patch statement.

Have a global variable called varBooking, which contains the entire Booking record, however am getting an error with the Patch statement.

Can anyone assist with providing the correct Patch syntax...thank you

pastedimage1577413826509v1.png 

I have the same question (0)
  • ba365guy Profile Picture
    2,950 on at

    What is the 'Booking Status'.'Field Service Status'

    Is it an attribute in Bookable Resource Bookings?

    Why is it in quotes?

  • RichardB 99 Profile Picture
    5 on at

    Hi there,

    Thanks for the quick response..

    This is the syntax for filtering the gallery to get the booking record, so I simply tried to reference the same  field names to try and update.  

    Filter('Bookable Resource Bookings','Booking Status'.'Field Service Status'= 'Booking System Status'.Scheduled)

    Booking Status is a Lookup field

    pastedimage1577418013077v1.png

  • Suggested answer
    ba365guy Profile Picture
    2,950 on at

    If you want to execute filter, please use filter function inside patch. Your original post doesn't show usage of filter function.

    For example, you want to modify a record in a data source, named IceCream, that contains the data in the below table

    pastedimage1577418422990v1.png

    Patch( IceCream, Filter( IceCream, Flavor = "Chocolate" ) , { Quantity: 400 } )

    So, your patch should be as follows:

    Patch('Bookable Resource Booking', Filter('Bookable Resource Booking', 'Booking Status'.'Field Service Status'= 'Booking System Status'.Scheduled), {'Booking Status'.'Field Service Status' = 'Booking System Status'.Completed})

    The above is just a sample, although you should filter the actual booking using an ID / Work Order Reference. 

  • RichardB 99 Profile Picture
    5 on at

    Have experimented further using this syntax...

    Set (varNewBooking,Filter('Bookable Resource Bookings', bookableresourcebookingid = varBooking.bookableresourcebookingid));

    Patch('Bookable Resource Bookings',First(varNewBooking),{'Booking Status'.'Field Service Status' = 'Booking System Status'.Completed})

    The varNewBooking variable was used to examine the results of the Filter, and although it worked OK, it actually returned a Table, so I used the First () function to return a single record.

    Unfortunately am still getting the original error ..inside the Patch statement 'Booking Status'.'Field Service Status'.

    Still think the problem is related to this Lookup field.. but will be very happy to be proved wrong

  • ba365guy Profile Picture
    2,950 on at

    I am still not able to figure out why you keep these('Booking Status'.'Field Service Status') under quotes.

    Does the data object(varNewBooking) have them in quotes?

    Pass the attribute without quotes

  • AJ-22040756-0 Profile Picture
    on at

    Hi Partner,

    You can also refer the article docs.microsoft.com/.../function-filter-lookup which has a sample and the detailed information to patch a lookup field along with Syntax.

    Hope this helps.

    Best regards,

    Akash

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • RichardB 99 Profile Picture
    5 on at

    'Booking Status' is the Display name and BookingStatus is the underlying field name.. I believe you can refer to either, but because there are spaces in the Display name you have to wrap them in single quotes.

  • RichardB 99 Profile Picture
    5 on at

    Hi Akash,

    Thanks for the link, however I couldn't see any mention how to Patch a lookup field, could you provide some further information on how to Patch a Lookup field in D365

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 45 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 27 Most Valuable Professional

#3
Soundari Profile Picture

Soundari 15

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans