Quantcast
Channel: Jason Lattimer's Groups Activities
Viewing all articles
Browse latest Browse all 869

How to use javascript document.createElement, document.body, $(document) in HTML Webresouce as per Microsoft CRM Code Review?

$
0
0

First of all, I am not regular blogger and I am damn confuse. Please guide me if my question is not up to the mark. I will try to improve.

I have submitted a Microsoft CRM PlugIn of Microsoft Code Review. I am new in Javascript. I got few suggestion from their side specially in Java Script.

Some of them are following. Can any body please guide me? That will be greatly helpful:

1- Microsoft Comments: 'document.createElement('script')' calls a document object function of the CRM document object model (DOM) directly. This technique is unsupported in all versions of Dynamics CRM. Remove or replace with a supported API provided in the Xrm.Page client object model. - Comments: 'document.body' calls a document object property of the CRM document object model (DOM) directly. This technique is unsupported in all versions of Dynamics CRM. Remove or replace with a supported API provided in the Xrm.Page client object model.

My code in .JS (as webresouce) file:

var NewScript = document.createElement('script')
NewScript.src = "ajax.googleapis.com/.../jquery.min.js"
document.body.appendChild(NewScript);

2-Module: sm_ordertest.htm.scripts

Statement: $(document)
Source: .../WebResources/ordertest.htm.scripts.js
Line: 5

Microsoft Comments: '$(document)' calls a global DOM-related function of the CRM document object model (DOM) directly. This technique is unsupported in all versions of Dynamics CRM. Remove or replace with a supported API provided in the Xrm.Page client object model.

My code in .HTML (as webresource) file:

<script type="text/javascript">
    $(document).ready(function () {
    //code
    }</script>

3-Module: sm_ManageSingleProduct.htm.scripts

Statement: $("#trnamesuccess")
Source: .../WebResources/SingleProduct.htm.scripts.js
Line: 109

Microsoft Comments: '$('#btnsave')' calls a global DOM-related function of the CRM document object model (DOM) directly. This technique is unsupported in all versions of Dynamics CRM. Remove or replace with a supported API provided in the Xrm.Page client object model.

My code in .HTML (as webresource) file:

<script type="text/javascript">
    function enableButton() {
        $('#btnsave').attr('disabled', false);
    }</script>

Viewing all articles
Browse latest Browse all 869

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>