Getting an error on Bookable Resource Booking that just randomly started.
Have some JS OnSave of the Bookable Resource Booking form which was working however now is having an error on the Field Service Mobile App. It basically checks if work order is a "breakdown" and if it's status is set to "complete" it checks if Fault Category is null and if it is it stops the Save and sets "Fault Category" required.
Doesn't happen on desktop only on mobile App so not sure if can debug like I would on desktop browser.
It does not happen every time I test.
It will work as expected make the field required and create an error notification message. I can then click the error message be taken to the field select a choice and save "complete".
This is the details from the script error:
function TestOnSave(executionContext) { var formContext = executionContext.getFormContext(); // get formContext var status = formContext.getAttribute("bookingstatus").getValue()[0].name; var faultcategory = formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("eye_faultcategory").getValue(); var incidenttype = formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("msdyn_primaryincidenttype").getValue()[0].name; if (status == "Completed" && incidenttype == "Breakdown" && faultcategory == null) { executionContext.getEventArgs().preventDefault(); // Stop the Save formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("eye_faultcategory").setRequiredLevel("required") } else { formContext.ui.tabs.get(3).sections.get(0).controls.get(0).getAttribute("eye_faultcategory").setRequiredLevel("none") } }
I know this is a form that uses PCF to get the work order parts of the form.
Any ideas?