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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Webresource - Javascript to show data from Web Request

(0) ShareShare
ReportReport
Posted on by 2,601

I want to create a web resource on a form which makes a javascript web call to CRM to display read-only fields. 

Is this possible?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    Hello,

    yes you can. Use the sparkleXRM to build your webressource and query (if you don't want to use knockoutJs or AngularJS):

    www.sparklexrm.com/.../default.html

    Best

  • Verified answer
    Nausher Sayeed Profile Picture
    522 on at

    Hi,

    You could write javascript function and register the function.

    function DisableHTMLWebresouceAndSubgridControl() {

       //Get the field value

       var fieldValue = Xrm.Page.getAttribute("attributename").getValue();

       //Get HTML web resource control

       var webRefCtrl = Xrm.Page.getControl("WebResource_WebResourceName").getObject();

       //Get Subgrid control

       var subGridCtrl = window.parent.document.getElementById("SubgridName_span");

       //If web resource and subgrid are not loaded yet, then call same function after some time.

       if ((webRefCtrl == null) || (subGridCtrl == null)) {

           setTimeout(DisableHTMLWebresouceAndSubgridControl, 1000)

           return;

       }

       //Check the required condition

       if (fieldValue == null) {

           //web resource HTML document

           var htmlDoc = webRefCtrl.contentDocument;

           //get list of controls by tag name

           var ctrlList = htmlDoc.getElementsByTagName('select');

           //get list of controls by Id

           var ctrlById = doc.getElementById('textCtrl');

           // disable control in HTML web resource.

           ctrlList[0].disabled = true;

           // disable the subgrid control

           subGridCtrl.disabled = true;

       }

    }

    Hope this helps.

  • CU21020959-0 Profile Picture
    2,601 on at

    Thanks for your reply Guillaume

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans