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

How to check and not select null values after using Fetch.xml

$
0
0

Hi.

I'm organizing forms, views and fields in MS CRM 2011 (UR5, Windows Server 2008 R2) for a Marina Company. And have a question about it.

To find the related boats' contact information, I used a dynamic search approach coded below;

--

function getContactInformation() {

    var relatedGrid = document.getElementById("contactInformationSubGrid");

    var lookupField = Xrm.Page.getAttribute("new_identitycode").getValue();

 

    if (relatedGrid == null || relatedGrid.readyState != "complete") {

        setTimeout('getContactInformation()', 2000);

        return;

    }

 

    var fetchXml = "<?xml version='1.0'?>";

        fetchXml += "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>";

        fetchXml += "<entity name='new_boatcard'>";

        fetchXml += "<attribute name='new_boatownerid' />";

        fetchXml += "<attribute name='new_captainid' />";

        fetchXml += "<attribute name='new_communicationid' />";

        fetchXml += "<attribute name='new_realownerid' />";

        fetchXml += "<attribute name='new_responsibleid' />";

        fetchXml += "<order attribute='new_boatownerid' descending='false' />";

        fetchXml += "<filter type='and'>";

        fetchXml += "<condition attribute='new_identitycode' operator='eq' value='"+lookupField+"'/>";

        fetchXml += "</filter>";

        fetchXml += "</entity>";

        fetchXml += "</fetch>";

 

    try {

        relatedGrid.control.setParameter("fetchXml", fetchXml);

        relatedGrid.control.refresh();

    }

    catch (e){

        relatedGrid.control.SetParameter("fetchXml", fetchXml);

        relatedGrid.control.Refresh();

    }

}

--

There's no problem right now. But here is the situation;

If these fields have NULL values stored in DB, the function coded above returns the NULL values too. And subGrid displays NULLs(which is normal)

--

<attribute name='new_boatownerid' />

<attribute name='new_captainid' />

<attribute name='new_communicationid' />

<attribute name='new_realownerid' />

<attribute name='new_responsibleid' />

--

If whole 5 values are NULL,  function returns an empty row displayed in subGrid(and when I click, I get an exception).

So, I want to check values if these 5 values are NULL, don't display the row. Is there any way to do this?

Thanks in advance.

Can


Viewing all articles
Browse latest Browse all 79901

Trending Articles



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