2013-03-27 45 views

回答

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);  
    } 
} 
+0

佩德羅,我需要在這裏申請代碼標準: – 2013-03-27 14:51:53

+0

@HugoSilva嗨這裏是你的代碼? – 2013-03-27 15:44:52

+0

謝謝我通過使用FetchXML解決了我的問題 – 2013-04-23 12:28:35

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