Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Issue with formContex.data.save

(0) ShareShare
ReportReport
Posted on by 5

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 

formContext.data.refresh(true) but the error still remains

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Issue with formContex.data.save

    Hi michaeljoye,

    I'm glad to hear that and thanks for sharing your solution.

  • michaeljoye Profile Picture
    5 on at
    RE: Issue with formContex.data.save

    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.

  • Community Member Profile Picture
    on at
    RE: Issue with formContex.data.save

    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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Adis Profile Picture

Adis 136 Super User 2025 Season 1

#2
Sohail Ahmed Profile Picture

Sohail Ahmed 81

#3
Jonas "Jones" Melgaard Profile Picture

Jonas "Jones" Melgaard 77 Super User 2025 Season 1

Product updates

Dynamics 365 release plans