Xml 如何根据crm 2011中的视图过滤器条件更新实体

Xml 如何根据crm 2011中的视图过滤器条件更新实体,xml,views,dynamics-crm-2011,crm,fetch,Xml,Views,Dynamics Crm 2011,Crm,Fetch,我正在尝试创建一个按钮,该按钮将根据视图中的筛选条件获取所有记录,直到现在我还可以创建该按钮并运行一个页面来更新实体中的所有记录,但现在我需要在视图中应用筛选条件,知道吗?可能吗?您需要在Javascript中执行此操作吗?您可以在插件中执行保存的视图(名为SavedQuery),请尝试以下操作: 使用(ServiceContext svcContext=newServiceContext(\u serviceProxy)) { var viewFetchXml=(来自svcContext.Cr

我正在尝试创建一个按钮,该按钮将根据视图中的筛选条件获取所有记录,直到现在我还可以创建该按钮并运行一个页面来更新实体中的所有记录,但现在我需要在视图中应用筛选条件,知道吗?可能吗?

您需要在Javascript中执行此操作吗?您可以在插件中执行保存的视图(名为SavedQuery),请尝试以下操作:

使用(ServiceContext svcContext=newServiceContext(\u serviceProxy))
{
var viewFetchXml=(来自svcContext.CreateQuery()中的q)
其中q.Name==“保存的查询名称”
选择q.FetchXml).FirstOrDefault();
if(viewFetchXml!=null)
{
FetchExpression查询=新的FetchExpression(viewFetchXml);
EntityCollection结果=\u serviceProxy.RetrieveMultiple(查询);
}
}

@Pedro,我不知道这是不是一种方法?我认为这将必须通过自定义工作流活动或插件来完成

protected static EntityCollection GetInfo(string EntityName)
        {
            OrganizationService _orgService;
            String connectionString = CrmClasses.Operations.Configuration.GetServiceConfiguration();

            CrmConnection connection = CrmConnection.Parse(connectionString);
            using (_orgService = new OrganizationService(connection))
            {
                QueryExpression request = new QueryExpression
                {
                    EntityName = EntityName,
                    ColumnSet = new ColumnSet { AllColumns = true },
                    Criteria =
                    {
                        Filters =
                                    {
     // -------------- insert here the filters criteria view?????????? --------
                      }
                    }                           
                };
                EntityCollection retrieved = _orgService.RetrieveMultiple(request);
                return retrieved;
            }
        }
        #endregion