Announcements
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!
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.
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.
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
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.
Not that it is the best solution, but won't just hiding the field (still keeping on the form) will resolve this issue?
I have actually wanted to know this as well
We will have to wait from someone at Microsoft to reply to this thread
André Arnaud de Cal...
294,095
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator