Skip to main content

Notifications

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!

  • Suggested answer
    moko33 Profile Picture
    1,788 on at
    RE: Changing Actual Arrive Time behavior

    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.

  • Gabriel Dias Junckes Profile Picture
    2,428 on at
    RE: Changing Actual Arrive Time behavior

    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.

  • Thomas David Dayman Profile Picture
    11,323 on at
    RE: Changing Actual Arrive Time behavior

    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

  • cavtg Profile Picture
    25 on at
    RE: Changing Actual Arrive Time behavior

    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.

  • Ali Khan Profile Picture
    1,380 on at
    RE: Changing Actual Arrive Time behavior

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

  • Thomas David Dayman Profile Picture
    11,323 on at
    RE: Changing Actual Arrive Time behavior

    I have actually wanted to know this as well

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

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans