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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Webresource using angularJs

(0) ShareShare
ReportReport
Posted on by 2

Hoi,

I have to migrate a 2011 application to dynamics 365. I have an issue with a AngularJS webresource tht gives an error on undefined element

In the account form, a webresource is hosted, that contains an angularJS form. The webresource itself is an html, which reference a controller, a module and a service javascript.

Goal is to update some field s of the account form, with the element chosen in the angular form.

The angular code looks like this:

$scope.ok = function () {var window_opener = window.dialogArguments;window_opener.FillAdresField(
    $scope.SelectedAdres.ves_adresid,
    null,
    $scope.SelectedAdres.ves_straat,
    $scope.SelectedAdres.ves_huisnummer); }

The FillAdresField is a function in a javascript library attached to the account form. It contains following code:

function FillAdresField(adresId, adresName, straat, huisnummer) {
    Xrm.Page.getAttribute("ves_adres1type").setSubmitMode("always");
    Xrm.Page.getAttribute("ves_adresid").setSubmitMode("always");
    Xrm.Page.getAttribute("address1_line1").setSubmitMode("always");
    Xrm.Page.getAttribute("address1_line2").setSubmitMode("always");
    Xrm.Page.getAttribute("address1_line3").setSubmitMode("always"); }

The Xrm.Page.Attributes seem not be known.

As I have no experience with this, can anyone point me in the right direction how to find a solution?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Radu Chiribelea Profile Picture
    6,667 on at

    Hi Birgit,

    Maybe you can try to reference the ClientGlobalContext.js.aspx inside your HTML web resources and then add there the logic of the FillAddressField method - as you will gain access to the Xrm.Page methods.

    Also, please check following articles for more information:
    msdn.microsoft.com/.../gg328541.aspx
    msdn.microsoft.com/.../gg309414.aspx
    community.dynamics.com/.../calling-custom-javascript-function-from-web-resource-on-parent-page
    dynamicscrm2011.wordpress.com/.../crm-2011-web-resource-part-1-using-html-web-resource
    dynamicscrm2011.wordpress.com/.../crm-2011-web-resource-part-2-how-to-use-clientglobalcontext-js-aspx

    Hope this helps!

    Radu

  • Verified answer
    JohnAnonymous Profile Picture
    5,241 on at

    If you want to fille the address field from javascript loaded in your iFrame webresource, you should prepend it with window.parent.

    So Xrm.Page.getAttribute("ves_adres1type").setSubmitMode("always");

    Would become

    window.parent.Xrm.Page.getAttribute("ves_adres1type").setSubmitMode("always");

    However, I read that you are calling a javascript function loaded on the form and not from your angular scripts. I don't know if that is wise to do.

  • Birgit RD Profile Picture
    2 on at

    After discussion with the colleague, decision was made to use a callback function iso calling a javascript function on the main form.

    Issue is solved.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
ScottDurow Profile Picture

ScottDurow 2

#2
GJones Profile Picture

GJones 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans