Linq Dynamics crm 2011 addlink与关系活动列表协会 Relationship Relationship=新关系(“活动列表协会”); 实体活动=(来自orgServiceContext.CreateQuery(“活动”)中的c) 选择c).FirstOrDefault(); foreach(listsMarketingGuid中的Guid id) { 实体列表=(来自orgServiceContext.CreateQuery(“列表”)中的l) 其中l[“listid”]等于(id) 选择l).FirstOrDefault(); orgServiceContext.AddLink(活动、关系、列表); orgServiceContext.AddLink(列表、关系、活动); } orgServiceContext.SaveChanges();
我想在营销列表和活动之间添加一个关系,但在执行SaveChanges语句时,我得到一个错误“活动项不支持关联”。 你知道吗?Linq Dynamics crm 2011 addlink与关系活动列表协会 Relationship Relationship=新关系(“活动列表协会”); 实体活动=(来自orgServiceContext.CreateQuery(“活动”)中的c) 选择c).FirstOrDefault(); foreach(listsMarketingGuid中的Guid id) { 实体列表=(来自orgServiceContext.CreateQuery(“列表”)中的l) 其中l[“listid”]等于(id) 选择l).FirstOrDefault(); orgServiceContext.AddLink(活动、关系、列表); orgServiceContext.AddLink(列表、关系、活动); } orgServiceContext.SaveChanges();,linq,relationship,crm,microsoft-dynamics,Linq,Relationship,Crm,Microsoft Dynamics,我想在营销列表和活动之间添加一个关系,但在执行SaveChanges语句时,我得到一个错误“活动项不支持关联”。 你知道吗? 感谢它需要调用方法AddItemCampaignRequest使用关联方法来建立关系: Relationship relation = new Relationship("campaignlist_association"); Entity campaign = (from c in orgServiceContext.CreateQuery("campaign")
感谢它需要调用方法AddItemCampaignRequest使用关联方法来建立关系:
Relationship relation = new Relationship("campaignlist_association");
Entity campaign = (from c in orgServiceContext.CreateQuery("campaign")
select c).FirstOrDefault<Entity>();
foreach (Guid id in listsMarketingGuid)
{
Entity list = (from l in orgServiceContext.CreateQuery("list")
where l["listid"].Equals(id)
select l).FirstOrDefault<Entity>();
orgServiceContext.AddLink(campaign, relation, list);
orgServiceContext.AddLink(list, relation, campaign);
}
orgServiceContext.SaveChanges();
其中EntityLogicalName是实体的名称
EntityId是实体的id
关系:什么样的关系
relatedentities:您希望与上述实体建立关系的实体。我得到了错误
“活动项不支持关联”
尝试将产品与活动关联时。这对我很有用:
_service.Associate(EntityLogicalName,EntityId,relationship,relatedEntities);
信条
希望这对某人有所帮助。您在哪里找到“AddItemCampaignRequest”?
var request = new AddItemCampaignRequest
{
CampaignId = yourCampaign.Id,
EntityId = productToAssociate.Id,
EntityName = ProductEntity.EntityLogicalName,
};
_serviceProxy.Execute(request);