Associate
I have a fetchxml query on a webresource in dynamics crm 2011, all works well apart from if a row contains null in which case the column is not returned for the row.
How can I check to ensure the row contains all of the columns required and if there is a column missing allocate a "" to the field requiring this value?
regards,
Matt
How can I check to ensure the row contains all of the columns required and if there is a column missing allocate a "" to the field requiring this value?
Code:
var _oService;
var _sOrgName = "A_CRMSystem";
var _sServerUrl = window.parent.Xrm.Page.context.getServerUrl();
var pcode = "a postcode";
var sFetch = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"+
"<entity name='a_postalcode'>"+
"<attribute name='a_postalcode' />"+
"<attribute name='a_country' />"+
"<attribute name='a_city' />"+
"<attribute name='a_postalcodeid' />"+
"<attribute name='a_street3' />"+
"<attribute name='a_street2' />"+
"<attribute name='a_street1' />"+
"<order attribute='a_country' descending='false' />"+
"<order attribute='a_postalcode' descending='false' />"+
"<filter type='and'>"+
"<condition attribute='a_postalcode' operator='eq' value='"+ pcode +"' />"+
"</filter>"+
"</entity>"+
"</fetch>";
_oService = new FetchUtil(_sOrgName, _sServerUrl);
var res = _oService.Fetch(sFetch);
for (var i = 0; i < res.length; i++)
{
var fn1 = "";
var fn2 = "";
var fn3 = "";
fn1 = res[i].attributes["orb_street1"].value;
fn2 = res[i].attributes["orb_street2"].value;
fn3 = res[i].attributes["orb_street3"].value;
bindData(tableID, fn1, fn2, fn3);
}
regards,
Matt