0
每當CRM上的任何實體中有更新時,除了其ID以外,只有該實體的更新字段纔會傳遞給相應的插件。我想用CRM中的所有字段檢索實體。事實證明,我可以做到這一點通過下面的代碼從CRM 4.0中檢索實體
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
因此,當我取回實體如下
service.Retrieve(entity.LogicalName, entity.Id, cols);
它返回的數據類型爲「實體」。我怎樣才能改變它讓我們說聯繫或帳戶。 如果我使用了一些這樣的事
service.Retrieve(entity.LogicalName, entity.Id, cols).ToEntity<contact>()
...它不承認接觸。
任何想法??