Context:
So on a form, I have a setup a OnLoad event via the form editor(the OnLoadEvent is called "pits.UserReport.OnFormLoad"). I have create a custom ribbon button called "Submit Report", and made it visible to all statuscode but "Submitted" and "Approved". The form statuscode defaults to "New", then when it is saved there is a plugin that set the statuscode to "Saved"
When a user hit the "Submit Report" button , the form should save(if it is new or dirt) then make a custom api call. I having this weird error that whenever I click the button I get this error:
Web resource method does not exist: pits.UserReport.OnFormLoad. However the closest object we found is pits that contains these properties: userReportRibbon,quoteRibbon. Please verify this object is not corrupt and is not an object of the same name defined elsewhere, such as another script.Session Id: 83aaf2bb-2d7c-4406-bc50-a9c778734fb5Correlation Id: d78cf2b6-3f81-4a55-b2ed-cecead8320caEvent Name: onloadFunction Name: pits.UserReport.OnFormLoadWeb Resource Name: pits_FormMainSolution Name: ActivePublisher Name: DefaultPublishercmicrmTime: Fri Mar 25 2022 01:50:41 GMT-0400 (Eastern Daylight Time)
Yeah the whole thing does do what I want in the end, but my end users are going to get very confuse, and some(the ever error throw is the end of world) will see the error and just stop working till no error is throw. It seems like the formContext.data.save() is saving the entity, and trying to refresh the page.
I do know that the method pits.UserReport.OnFormLoad does exist since it work when I first open the form, but not after executing formContext.data.save(). I even tried