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

Community site session details

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

Xrm.WebApi in a stand alone Web Resource

(0) ShareShare
ReportReport
Posted on by 5

I have a stand alone web resource linked from the site menu in a Model Driven App. It does multiple api calls using parent.Xrm.WebApi and currently works fine. According to Microsoft deprecation notice, https://docs.microsoft.com/en-us/power-platform/important-changes-coming, parent.Xrm will be going away and no longer work for standalone Web Resource. Xrm.WebApi without referencing the parent throws an error "Xrm" is not defined. Can anyone help with a supported way to access Xrm.Utility and Xrm.WebApi from a standalone web resource?

NOTEparent.Xrm will be removed after the removal of the ClientGlobalContext.js.aspx page; dates yet to be announced.

I have the same question (0)
  • Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: Xrm.WebApi in a stand alone Web Resource

    Hi,

    As per docs parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource.

    docs.microsoft.com/.../important-changes-coming

    Please mark my answer verified if i were helpful

  • DanWa Profile Picture
    5 on at
    RE: Xrm.WebApi in a stand alone Web Resource

    I am using a Web Resource linked from the site menu, not embedded in to a form.  

    "parent.Xrm.* will work if the HTML web resource is loaded in a form container. However, for other places, such as loading an HTML web resource as part of the SiteMap, parent.Xrm.* also won’t work."

    So I am trying to find out if there is a supported way to access Xrm in this scenerio

  • Diana Birkelbach Profile Picture
    140 Most Valuable Professional on at
    RE: Xrm.WebApi in a stand alone Web Resource

    A possibility would be to use PCF (PowerApps Component Framework).

    The PCF could be defined for datasets (so you can bind a PCF to an Entity  which is shown in the home grid).

    Maybe you get even more: the Dataset PCFs could give you even the data that you retrieve now using the Xrm.WebApi (or at least a part of it).

    This would work now.

    In the future, also unbound PCFs will be possible (then you don't need a view to bind the PCF).

    Kind regards,

    Diana

  • Suggested answer
    Pankaj Gogoi Profile Picture
    3,177 on at
    RE: Xrm.WebApi in a stand alone Web Resource

    Hi DanWa,

    I think you can use the getContentWindow() method. This will work only on Unified Interface.

    https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/reference/controls/getcontentwindow

    https://www.inogic.com/blog/2020/08/how-to-use-xrm-and-formcontext-in-html-webresource-in-dynamics-365-crm/

    Hope this helps.

    Best Regards

    PG

  • Noorahmad001 Profile Picture
    130 on at
    RE: Xrm.WebApi in a stand alone Web Resource

    Did you find any solution for the problem you posted in the community i.e. using xrm in standalone webresource in Dynamics 365

  • Suggested answer
    Sivert Byfuglien Profile Picture
    on at
    RE: Xrm.WebApi in a stand alone Web Resource

    Try using opener.Xrm to access the Xrm object in a standalone webresource opened from a form as described here in the parent.Xrm section: docs.microsoft.com/.../important-changes-coming

    "If the getContentWindow method doesn't work, you can use parent.Xrm to get to the Xrm object inside an HTML web resource. If the HTML web resource is opened in a new window, then you should use opener.Xrm instead."  

  • Community member Profile Picture
    2 on at
    Xrm.WebApi in a stand alone Web Resource

    I am using a Web Resource linked from the site menu, not embedded in to a form.  

    "parent.Xrm.* will work if the HTML web resource is loaded in a form container. However, for other places, such as loading an HTML web resource as part of the SiteMap, parent.Xrm.* also won’t work."

    So I am trying to find out if there is a supported way to access Xrm in this scenerio

    Do we have answer for this?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 242

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 83 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 68 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans