Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

XRM methods that work in web not working on Mobile -- Dynamics CRM 2016

Posted on by 95

Hello

My environment is CRM 2016 on premise. Configured IFD and using Dynamics 365 App for mobile.

THe XRM.Page.*** methods that work normally in web are not working on the mobile app.

I am trying to get an attribute value which is of type Two Options. I am able to get the attribute using

Xrm.Page.entity.data.getAttribute("attributename")

However when I say Xrm.Page.entity.data.getAttribute("attributename").getValue() -- says that there is no such method.

How can I get the value in this case?

Thanks

*This post is locked for comments

  • Verified answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: XRM methods that work in web not working on Mobile -- Dynamics CRM 2016

    I'm too adult to believe in miracles :)

    If your field is located on the form you can get value of it using

    Xrm.Page.getAttribute("fieldname").getValue()

    or

    Xrm.Page.data.entity.attributes.get("fieldname").getValue()

    Methods like getAttributes getControls e.t.c. are not documented i.e. not recommended and not supported.

    I don't see any point trying to get attribute using getControl...getAttribute way - because there is no need doing it.

    Just doublecheck that field is on the form. Mobile client has limitations on fields and tabs so get sure that field is rendered and is on the form.

  • reshmap Profile Picture
    reshmap 95 on at
    RE: XRM methods that work in web not working on Mobile -- Dynamics CRM 2016

    Thank you for the reply Andrew.

    I am able to get the attribute , using Xrm.Page.ui.getControls("fieldname") or Xrm.Page.entity.date.getAttribute("fieldname")

    However when I try to get the value of the attribute using .getValue(), it is failing with error "undefined"

    I have tried the below so far with no luck :(

    var  ctrl= Xrm.Page.getAttribute("fieldname"); -- not working on mobile but works on web

           var ctrl1= Xrm.Page.data.entity.attributes.get("fieldname"); -- not working on mobile

          var ctrl 2= Xrm.Page.data.entity.getAttributes("fieldname"); -- working on mobile

                ctrl2.getValue() -- "Undefined" error on mobile

          var test = Xrm.Page.getControl("fieldname"); -- working on mobile

          var ctrl3 = Xrm.Page.ui.getControls("botw_issubmitted");

          var value = ctrl.3getAttribute();  -- getAttribute is undefined error on mobile

                   if (value != null) {

                       return value.getText();

                   }

  • Suggested answer
    Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: XRM methods that work in web not working on Mobile -- Dynamics CRM 2016

    Xrm.Page.data.entity.attributes.get is the right syntax. Basically it has a shortcut - Xrm.Page.getAttribute

    crmbook.powerobjects.com/.../mscrm-object-model

    social.microsoft.com/.../what-is-the-difference-between-xrmpagedataentityattributesget-and-xrmpagegetattribute

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: XRM methods that work in web not working on Mobile -- Dynamics CRM 2016

    Hello,

    Based on the SDK documentation there are 2 sets of methods:

    1. Xrm.Page.getAttribute

    2. Xrm.Page.entity.data.get

    Use one of mentioned and it should work for both mobile and web. Good luck.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans