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

How to Clear Cache in Canvas PowerApps while working on Offline mode?

  Introduction In this blog, we’ll look at how to clear cache in Canvas Apps when using the Power Apps mobile application, especially when t...