Monday, February 3, 2014

Create View in CRM using coding.

 var fetchxml = "<fetch distinct='true' mapping='logical' output-format='xml-platform' version='1.0'><entity name='account'><attribute name='name'/><attribute name='primarycontactid'/><attribute name='telephone1'/><attribute name='accountid'/><order descending='false' attribute='name'/><link-entity name='incident' alias='ac' link-type='outer' to='accountid' from='customerid'/><filter type='and'><condition attribute='customerid' operator='null' entityname='incident'/><condition attribute='statecode' operator='eq' value='0'/></filter></entity></fetch>";

            var savedQuery = new SavedQuery()
            {
                Name = "Acount with no Cases",
                ReturnedTypeCode = "account",
                FetchXml = fetchxml,

                QueryType = 0
            };
            _service.Create(savedQuery);

No comments:

Post a Comment