Hi All,
I am trying to create bookableresourcebooking record using offline js as follows.
function createBooking(ResourceId, ResourceName, workorderId, workorderName, bookingStatusID) {
var startDateTime = new Date();
startDateTime = startDateTime.setMinutes(startDateTime.getMinutes() - 60);
startDateTime = new Date(startDateTime);
var endDateTime = new Date();
var newBooking = new MobileCRM.DynamicEntity.createNew("bookableresourcebooking");
newBooking.properties.starttime = startDateTime;
newBooking.properties.endtime = endDateTime;
newBooking.properties.duration = 1;
newBooking.properties.bookingstatus = new MobileCRM.Reference("bookingstatus", bookingStatusID, "Scheduled");
newBooking.properties.msdyn_workorder = new MobileCRM.Reference("msdyn_workorder", workorderId, workorderName);
newBooking.properties.resource = new MobileCRM.Reference("systemuser", ResourceId, ResourceName);
newBooking.save(function (err) {
if (err != null) {
document.getElementById("error").innerHTML += "<p> " + err + " </p>";
}
else {
document.getElementById("error").innerHTML = "<p> Sucessfully created a booking </p >";
}
}
);
}
But I am geeting following error
Server Error: Length cannot be less than zero. Parameter name: length
I hope this error comes due to start time and end time (when both are equal)

Could please someone help me to resolve this issue?