0
我想創建一個按鈕,將獲取視圖中的所有記錄基於篩選條件,直到現在我可以創建按鈕並運行一個頁面實體中所有記錄的更新,但現在我需要在視圖中應用過濾器標準,任何想法?可能嗎?如何更新實體基於視圖篩選器標準在crm 2011
我想創建一個按鈕,將獲取視圖中的所有記錄基於篩選條件,直到現在我可以創建按鈕並運行一個頁面實體中所有記錄的更新,但現在我需要在視圖中應用過濾器標準,任何想法?可能嗎?如何更新實體基於視圖篩選器標準在crm 2011
你需要在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);
}
}
@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-27 14:51:53
@HugoSilva嗨這裏是你的代碼? – 2013-03-27 15:44:52
謝謝我通過使用FetchXML解決了我的問題 – 2013-04-23 12:28:35