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
Hi michaeljoye,
I'm glad to hear that and thanks for sharing your solution.
I was able to resolve this issue. The issue is that pits.UserReport was not in the WebResource as the ribbon button JS. I ended up having to package everything into one js file.
I had two js files one for ribbon and one for forms.
Somehow the refresh was just happening in just context of the ribbon js page.
Hi michaeljoye,
Usually, this error is caused by the syntax error or you type the wrong function name in onload event. However, you say it work fine on you first load the form. So it shouldn't cause by those. Could you provide your JS code of pits.UserReport.OnFormLoad for further research?
Adis
136
Super User 2025 Season 1
Sohail Ahmed
81
Jonas "Jones" Melgaard
77
Super User 2025 Season 1