Announcements
Hi,
I am using the following code in a webresource which can be launched from the Sitemap and it is used to show a canvas App. and i am geting the Canvas AppID dynamically then pass it into the src parameter of the iframe tag:
but the problem arises when I perform the PowerApps Checker using AppSource rules, and it fails to pass due to the
Hi Mohammad,
Like I said before, use of getElementByID to access any DOM element within your web resource content is supported. If you have an html element lets say an input tag inside your web resource, you cannot use Xrm client side libraries to access that. You either have to use vanilla JavaScript function like getElementbyId or jquery or other libraries to access that element. Please see the following from the docs page
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-javascript
The error you are getting is pointing to the same paragraph and the rule that tirggers this error is :
Clearly your script is not trying to access DOM element of CRM application pages or the entity form. You script is trying to access an element within your web resource content. This is in my view is a false negative. I assume you are not planing to submit your work to AppSource, and if thats the case, I would use the Solution Checker rule-set. I tried your webresource with solution checker rule-set and it does not complaint.
If your work has to be submitted to AppSource, you can still submit the package and the team that reviews code will ignore any false positives / negatives.
Just wanted to show you an example web resource code that is part of the CRM SDK does use document.getElementById to display content within the web resource
Hope this helps
Hi Mohammad,
Indeed, using document.getElementById is not supported.
If you want to load a canvas app dynamically into a web resource, you can use the setSrc method provided by Dynamics and pass the correct URL: docs.microsoft.com/.../setsrc
Maybe this could work in your implementation.
Thank you!
Kokulan, thanks for your prompt response. you are totally right, testing using Power Apps checker in the Power Apps maker portal, shows zero errors, but i am using DevOps to export and deploy my solutions, and I am using the Power Apps Checker task from he Power Platform tasks,
which as you can see in the screenshot, you can choose the stricter rule set of AppSource Certification, then it produces a sarif file, and this checker sets the alarm on for
Hi
An html webresource can use getElementByID to access the elements within the webresource content. Your example above is not trying to access any elements on the form so should not get the unsupported error.
I ran the solution checker with your HTML and the tool does not complaint about the getElementByID, please see below
Could you please double check the solution checker result, it could be complaining about other web resources?
André Arnaud de Cal...
294,137
Super User 2025 Season 1
Martin Dráb
232,877
Most Valuable Professional
nmaenpaa
101,158
Moderator