Tuesday, March 15, 2016

Get View ID Based on View Name MSCRM 2013 & CRM 2015

Hi All,

Get View ID Based on Name


GetViewIdByName("ViewName");

function GetViewIdByName(viewName) {
    var viewId = "";
    var fetchXml =
       "<fetch mapping='logical'>" +
          "<entity name='savedquery'>" +
          "<attribute name='savedqueryid' />" +
          "<filter>" +
          "<condition attribute='name' operator='eq' value='" + viewName + "' />" +
          "</filter>" +
          "</entity>" +
       "</fetch>";

    var retrievedViews = XrmServiceToolkit.Soap.Fetch(fetchXml);
    viewId = retrievedViews[0].attributes['savedqueryid'].value;
    return viewId;
}

No comments:

Post a Comment

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...