我正在尝试创建一个按钮,它将根据视图中的过滤条件获取所有记录,直到现在我可以创建按钮并运行一个页面来更新实体中的所有记录,但现在我需要应用在视图中过滤条件,有什么想法吗?可能吗?
问问题
244 次
2 回答
0
您需要在 Javascript 中执行此操作吗?您可以在插件中执行保存的视图(名为 SavedQuery),试试这个:
using (ServiceContext svcContext = new ServiceContext(_serviceProxy))
{
var viewFetchXml = (from q in svcContext.CreateQuery<SavedQuery>()
where q.Name == "Saved Query Name"
select q.FetchXml).FirstOrDefault();
if (viewFetchXml != null)
{
FetchExpression query = new FetchExpression(viewFetchXml);
EntityCollection results = _serviceProxy.RetrieveMultiple(query);
}
}
于 2013-03-27T12:34:14.717 回答
0
@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
于 2013-03-27T14:59:28.143 回答