web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

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

I have the same question (0)
  • Community Member Profile Picture
    on at

    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?

  • michaeljoye Profile Picture
    5 on at

    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.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi michaeljoye,

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

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

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 41 Most Valuable Professional

#2
iampranjal Profile Picture

iampranjal 39

#3
Satyam Prakash Profile Picture

Satyam Prakash 35

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans