Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

getattribute returns a null value when trying to retreive information from a Quick View Form in CRM 2016

$
0
0

Hi All,

Just to confirm that I have run the following code through the Code Validation tool and all checks out well. I have also confirmed that this code works well when I use the "Legacy Form Rendering Engine"

Note: I am using CRM 2016 On-Premise and the following is running "OnLoad" using the Case Form. I have a Quick View Form on the Case form which I am trying to retreieve some information from.

function Iframe_OnReadyStateComplete() {
    var iFrame = Xrm.Page.ui.controls.get('IFRAME_COLOR');
    var serverUrl = iFrame.getSrc();
    if (serverUrl.indexOf("about:blank") != -1) {
        setiFrameUrl();
    }
}

function setiFrameUrl() {
     var iframeObject = Xrm.Page.getControl("IFRAME_COLOR");
     var entityName = Xrm.Page.data.entity.getEntityName();
     var serverUrl = Xrm.Page.context.getClientUrl() + '/WebResources/';
     var controlName = Xrm.Page.getControl("remote_support_member_qv1_remote_support_member_qv1_account_new_remotesupportmember").getAttribute().getValue();
     if (controlName == false) {
         // Set Color Bar Red
         iframeObject.setVisible(true);
             iframeObject.setSrc(serverUrl + 'new_colorBarRed');
     }
     else {
         iframeObject.setVisible(true);
         if (controlName == true) {
             // Green Color
             iframeObject.setSrc(serverUrl + 'new_colorBarGreen');
       }
     }
 }


What happens in the above code is that it changes the contents of an iFrame on the Case form depending on the value retrieved in the "var controlName" section. The "var controlName" is retreieving the value from a Quick View Form which is on the Case Form. The exact error is this:

TypeError: Unable to get property "getAttribute" of undefined or null reference at SetIframeUrl

This works very well when used in legacy forms rendering but is not working with new Forms rendering engine yet the code is validated perfectly.

I am suspecting a bug in the new Forms Rendering Engine which for some reasons always returns a null value when trying to retreive a value from a Quick View Form.

Here is an example of how it works:

mahadeomatre.blogspot.com.au/.../access-quick-view-form-values-in.html

Anyone have any ideas or an alternative solution to get the same thing working in the new Forms Rendering Engine?


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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