How to use parent.Xrm.WebAPI in standalone web resources (not in CRM form)
Are you working with CRM on-premises and developing a standalone web resources without CRM form ? You can face with this trouble and this article is for you.
What is the issue?
Basically, we need to include a reference to ClientGlobalContext.js.aspx to HTML web resources but it does not make the Xrm object available. Therefore, scripts containing Xrm.* methods aren't supported in HTML web resources. And the scripts containing parent.Xrm.* will work if the HTML web resources is loaded in a form container. However, for other places, such as loading an HTML standalone web resources, parent.Xrm.* also won't work. If you try to use it on standalone web resources in on-premise environment version 9.1 (or 9.0), you will receive the error:
Root cause
After a lot of time to debug this error, I found it come from the Xrm.WebApi method. It is failing on a line where it attempts to take the entityname and resolve it to the setname (plural). It does this by comparing the value passed into the retrieveMultipleRecords method and comparing it to a global variable ENTITY_SET_NAMES.
This variable is unfortunately not present and parent.Xrm.WebApi throws an error.
Workaround
However, the standalone web resources is needed in some scenarios with specific business which we must accept the unsupported way to leverage the advantages of its and we could do a "magic" to use parent.Xrm.* into the standalone web resources.
Note: Please be aware that: This is the unsupported method.
First of all, we need to identify how many entities we work with parent.Xrm.WebApi in the web resource.
And those entities are not present in global variable ENTITY_SET_NAMES. So we create it.
In the window variable, we create an attribute ENTITY_SET_NAMES is a JSON-parsable string which contains the logical name and set a name for each entity.
Finally, we need execute that function before any calls to parent.Xrm.WebApi methods appears to work.
Some final words
Now, your issue should be resolved. Hope that Microsoft will fix it soon and the article will become a good resource for you.
If you have any better solutions or any questions, feel free to comment below. Your opinions are appreciated.
Published on:
Learn moreWe can help you with How to use parent.Xrm.WebAPI in standalone web resources (not in CRM form)
If you want help implementing, troubleshooting, or improving this product, contact us and we’ll point you in the right direction.
Related posts
Contact Center Intelligence: where it fits next to Dynamics 365 Contact Center
Microsoft Contact Center Intelligence is generally available. What it adds to an existing contact center, how it relates to Copilot Studio, an...
Inventory data export ends: move to the Power Platform inventory API
Data export (preview) stops sending inventory data after December 1, 2026. How to rebuild the feed with the inventory API, and which fields yo...
Dynamics 365 plugins for Copilot Cowork: an admin setup checklist
The ERP, Sales and Customer Service plugins bring Dynamics 365 data into Copilot Cowork through MCP servers. What to configure, and where it b...
Migrate a Power Pages site to the enhanced data model with PAC CLI
A step-by-step guide to moving a Power Pages site off the adx_ tables with pac pages migrate-datamodel: modes, ALM sequence, remediation and r...
Copilot features retiring from Power Apps and Power Automate
Between November 30 and December 31, 2026, several in-studio Copilot and collaboration features disappear. What goes, what stays and what to u...
Unmanaged developer environments are ending: what to do before December 15
Unmanaged developer environments can no longer be created, are suspended on December 15, 2026 and deleted in January. Who is affected and how ...
Backfill Dataverse prompt columns on existing records
Prompt columns only ran on new or updated rows. A bulk option now fills existing records as a system job: the two settings, the steps and the ...
Reveal a masked Dataverse column with Dataverse.Unmask
A new Power Fx function lets authorised users of a canvas app reveal one masked Dataverse value on demand, while column security stays in char...
Generative pages in model-driven apps: a practical guide
What generative pages are, where they stand in November 2026, the two ways to build them, the code they produce, and the limits to plan for.
Big Update — CRMJetty Dynamics 365 Portal Now Comes with Powerful New Integrations
Enterprise portals are evolving rapidly. They are no longer mere portals through which CRM records can be viewed. Portals are now expected to ...