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

Changing Actual Arrive Time behavior

(0) ShareShare
ReportReport
Posted on by 25

Hi

In our scenarion Actual Arrive Time is not relevant but there is requirements for that in Bookable Resource Booking Field Service JS. Which is the proper way to change that functionality which is in JS file? Change that Microsoft JS? Do it somehow via solution? Add another JS to prevent those actions?

Example from FS.BookableResourceBooking.Library.js:

Library.OnSave = function (executionObj) {

                if (!FPS.BookableResourceBooking.Library.SystemSaveData) {

                    var needProcessRule = true;

                    var startTime = FPS.BookableResourceBooking.Metadata.getStartTime();

                    var endTime = FPS.BookableResourceBooking.Metadata.getEndTime();

                    var actualArrivalTime = FPS.BookableResourceBooking.Metadata.getActualArrivalTime();

                    var validationMsgId;

                    if (endTime <= startTime) {

                        validationMsgId = "BookableResourceBooking_EndTimeLaterThanStartTime";

                    }

                    else if (actualArrivalTime && startTime > actualArrivalTime) {

                        validationMsgId = "BookableResourceBooking_StartTimeCouldntBeLaterThanActualArrivalTime";

                    }

                    else if (actualArrivalTime && endTime < actualArrivalTime) {

                        validationMsgId = "BookableResourceBooking_EndTimeCouldntBeEarlierThanActualArrivalTime";

                    }

                    if (validationMsgId) {

                        // Do not show the message again if validation error dialog is still opened

                        if (!FPS.BookableResourceBooking.Library.IsErrorDialogOpened) {

                            FPS.BookableResourceBooking.Library.IsErrorDialogOpened = true;

                            Xrm.Utility.alertDialog(FPS.Localization.getResourceString(validationMsgId), function () {

                                FPS.BookableResourceBooking.Library.IsErrorDialogOpened = false;

                            });

                        }

                        executionObj.getEventArgs().preventDefault();

                        return;

                    }

                    if (FPS.BookableResourceBooking.Library.ValidateDates() == false) {

                        executionObj.getEventArgs().preventDefault();

                        return;

                    }

                    if (Xrm.Page.data.entity.getIsDirty() == true) {

                        // Disable processing rules in offline, because the rules may trigger some JS libraries that are not available offline

                        if (FpsUtils.IsMobileClientOffline()) {

                            // TODO: uncomment once localization is implemented for UCI

                            //Xrm.Utility.alertDialog(FPS.Localization.getResourceString("BookingRules_NotBeExecutedInOffline"));

                        }

                        else {

                            FPS.BookableResourceBooking.Library.ProcessingRules(executionObj);

                        }

                    }

                }

            };

 Thanks!

I have the same question (0)
  • Thomas David Dayman Profile Picture
    11,323 on at

    I have actually wanted to know this as well

    We will have to wait from someone at Microsoft to reply to this thread

  • Ali Khan Profile Picture
    1,380 on at

    Not that it is the best solution, but won't just hiding the field (still keeping on the form) will resolve this issue?

  • cavtg Profile Picture
    25 on at

    No. I tried both hiding (Visible by default) and remove it but it wont change anything.

    Also i looking for general best practice to how change logic which Microsoft is hard coded to JS instead of configured via solution.

  • Thomas David Dayman Profile Picture
    11,323 on at

    What about disabling the field itself in woodford?

    At this moment in time I have just commented out parts which I don't want to happen

  • Gabriel Dias Junckes Profile Picture
    2,428 on at

    Hi.

    I would not change Microsoft JS because it might break in further updates. Perhaps, we can add another rule to set the field when the start time is populated.

  • Suggested answer
    moko33 Profile Picture
    1,788 on at

    For lots of our customers the MS scripts here have not provided any value, but caused more work when implementing Field Service Mobile. However we're usually fine after having created some Form Rules that populate the necessary values into these fields and hiding them.

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 55 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