Sharing below code which returns some value using oData query. This function will check if there is any open activity related to Incident entity.

function CheckOpenActivity() {

var Id = parent.Xrm.Page.data.entity.getId();

var IncidentId = Id.substring(1, 37);

//Retrieve dynamically the organization’s server url

var¬†serverUrl = document.location.protocol +¬†“//”¬†+ document.location.host +¬†“/”¬†+ Xrm.Page.context.getOrgUniqueName();

var¬†ODATA_ENDPOINT =¬†“/xrmservices/2011/OrganizationData.svc”;

var¬†ODATA_EntityCollection =¬†“/IncidentSet?$select=IncidentId,Incident_ActivityPointers/ActivityId,Incident_ActivityPointers/StateCode&$expand=Incident_ActivityPointers”;

var¬†ODATA_Filter1 =¬†“&$filter=IncidentId eq guid'”¬†+ IncidentId +¬†“‘”;

var oDataRequestUrl = serverUrl + ODATA_ENDPOINT + ODATA_EntityCollection + ODATA_Filter1;

var result = syncODataCall(oDataRequestUrl);

var isOpenActivity = ProcessReturnedEntities(result);

if (isOpenActivity)
alert(‘The Case has open Activity’);
else
alert(‘The Case has not any open Activity’);

}

// function to make synchronous oData call

function syncODataCall(odataSelect) {

var request = new XMLHttpRequest();

request.open(“GET”, odataSelect,¬†false);

request.setRequestHeader(“Accept”,¬†“application/json”);

request.setRequestHeader(“Content-Type”,¬†“application/json; charset=utf-8”);

request.send();

var objJQuery = jQuery.parseJSON(request.responseText);

return objJQuery.d

}

function ProcessReturnedEntities(d) {

var hasRelated = false;

if (d.results[0] != null) {

var activities = d.results[0].Incident_ActivityPointers;

if (activities != null) {

if (activities.results.length > 0) {

$.each(activities.results, function (index) {

if¬†(activities.results[index].StateCode.Value ==¬†‘0’) {

hasRelated = true;
return hasRelated;

}
});

} else {
hasRelated = false;
return hasRelated;
}

} else {
hasRelated = false;
return hasRelated;
}
}
return hasRelated;
}

 

Hope this help you.


Hi,
We faced some CRM Issue based IE Version i.e some of the functionality was working fine in IE 8.0 and IE 9.0 but not working on IE 10.0 or later.. I had written the below function to detect the IE version and chage the logic accordingly.

function MSIEVersion() {
var ua = window.navigator.userAgent;
var msie = ua.indexOf(“MSIE “)
var rv = ua.indexOf(“rv:”);
var compatible = ua.indexOf(“compatible”);
var ieVersion;

// If IE Version <= 10 and compatiable mode return version number
if ((msie > 0) && (rv == -1) && (compatible > 0))
{
ieVersion = parseInt(ua.substring(msie + 4, ua.indexOf(“.”, msie)));
if (ieVersion == 10)
{
ieVersion = ieVersion + 1;
}
return ieVersion;
}
// If IE Version <= 10 and not in compatiable mode return version number
if ((msie > 0) && (rv == -1) && (compatible == -1))
{
ieVersion = parseInt(ua.substring(msie + 4, ua.indexOf(“.”, msie)));

return ieVersion;
}
// If IE Version > 10, return version number
if ((msie == -1) && (rv > 0))
{

// If IE Version > 10
ieVersion = parseInt(ua.substring(rv + 3, ua.indexOf(“.”, rv + 5))); ¬†¬†¬†¬†¬†¬†¬† r
eturn ieVersion;
}
}

Hope it helps..


To Enable the field on Assign of any entity record, call the below function. On Assign of record, only save event triggered in CRM 2013, so we have to call the function on OnSave. Check the Save Mode for Assign( Save Mode of Assign = 47) and write your logic there..

function EnableFieldOnAssign(prmContext)
{
if (prmContext.getEventArgs().getSaveMode() == 47)
{
Xrm.Page.getControl(“mst_casestatus”).setDisabled(false);

}

}

Hope this helps..


Microsoft Dynamics CRM 2014 Release Schedule.


Hi

Cleared Extending Microsoft Dynamics CRM 2013 (MB2-701) today. Most of the questions was from CRM 2011 and some new classes from CRM 2013.

 


Cleared Microsoft Dynamics CRM 2013 Customization and Configuration ( MB2 – 703 ) Exam today which contains mainly below topics.

  • Business Process Flow
  • Dashboard and Charts
  • Access Teams
  • Quick Create Forms
  • Views
  • CRM for Tablets