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!