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

Announcements

News and Announcements icon
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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

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

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 63 Most Valuable Professional

#2
11manish Profile Picture

11manish 23

#3
Hamza H Profile Picture

Hamza H 14 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans