Skip to main content

Notifications

Announcements

No record found.

Service | Customer Service, Contact Center, Fie...
Suggested answer

Booking Status readonly on Mobile (Woodford)

(0) ShareShare
ReportReport
Posted on by 155

Hi all

It looked very simple from the requirement but I think I am stuck in one of the silly issues. 

I need to set the Booking status field (on Bookable Resource Booking) form as readonly. I tried to do this using rules on OnLoad, OnChange but unfortunately, it's still enabled and it lets the user change the status. Once the user changes the status then the OnChange fires and then it makes it readonly.

On Load

On Change

Booking-Statuses.jpg

I want it to be readonly as soon as it's loaded. How can I do that? 

  • Suggested answer
    rskadk1 Profile Picture
    rskadk1 880 on at
    RE: Booking Status readonly on Mobile (Woodford)

    I have encountered same problem - with other fields also. It's because Microsoft have some offline HTML code for the BRB that's overruling. (Actually they have just overtaken old Field One code and haven't bothered looking into this and mainly replaced all f1_ with msdyn_) In a lot of scenarious it seems like Microsoft are using this approach using offline html - and proberly because they didn't bother chaning it. You have to know what you are doing but a solution is to comment as many of those Microsoft customizations out as possible or remove them in the brb.js - however since Microsoft have done it this way you are risking to break something else.  In fact i don't see why they have done it this way since all that coding could be done by simple woodford rules.....!

    it's this code that's causing it. Actually i think i ended up just renaming the General tab in BRB in woodford to break the code... This also broke some other code enabling/disabling different fields in BRB that Microsoft thought was a good idea...! So win win

       setBookingStatusFieldIsEnabled: function (entityForm) {

           var detailView = entityForm.getDetailView(FS.Common.TabNames.BRB_BookingTab);

           var bookingStatusItem = detailView && detailView.getItemByName(FS.Schema.BookableResourceBooking.properties.bookingStatus);

           if (detailView && bookingStatusItem) {

               // disable booking status field if it's already disabled or if status is Completed; enable it otherwise

               bookingStatusItem.isEnabled = bookingStatusItem.isEnabled !== false ? FS.BookableResourceBooking.currentFSStatus !== FS.Enums.msdyn_bookingtimestampmsdyn_SystemStatus.Completed : false;

           }

       },

  • Arafat Profile Picture
    Arafat 155 on at
    RE: Booking Status readonly on Mobile (Woodford)

    @Stefan, does executionContext work for the mobile app as well?

  • Suggested answer
    Thomas David Dayman Profile Picture
    Thomas David Dayman 11,323 on at
    RE: Booking Status readonly on Mobile (Woodford)

    Is this something that is being caused by Microsofts BRB offline HTML code?

    Also as another solution you could just have the booking status field open, but have the lookup view not show any results apart from the value that is inside the loouk and have the field as business required?

    That means if the user removes remove the field then they are forced to add the same value back

  • RE: Booking Status readonly on Mobile (Woodford)

    Hi Arafat,

    You could try using a simple javascript function to automatically lock the field when the form loads.

    Try adding the code below on the OnLoad event of your form:

    function lockField(executionContext) {

       var formContext = executionContext.getFormContext();

       formContext.getControl("bookingstatus").setDisabled(true);

    }

    Thank you!

  • Suggested answer
    Al Iggs Profile Picture
    Al Iggs on at
    RE: Booking Status readonly on Mobile (Woodford)

    Tried an OnChange rule and it's indeed not working as expected. However once I change the field value, then the rule triggers and makes the field read-only. So it could be a bug worth verifying with Resco support.

    Here's a workaround: Create a shared variable that also holds the booking status. Depending on your conditions, either show the status field and hide the variable (read-write behavior) or hide the status field and show the variable (read-only behavior).

    pastedimage1594194513486v1.png

    pastedimage1594194513486v2.png

    Have successfully tested this.

    Btw, did you see that the same question was posted here as well? https://community.dynamics.com/365/fieldservice/f/dynamics-365-for-field-service-forum/394985/booking-status-cannot-set-to-read-only-on-fs-app-resco

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans