无法以编程方式更新社交个人资料中的InfluenceScore

meh*_*kin 8 c# dynamics-crm dynamics-crm-2015

我们有一个新设置的CRM 2015内部部署环境; 我们正在努力摆弄社会关怀框架.

我们只是想InfluenceScore使用Web服务调用在我们的自定义应用程序中更新社交个人资料记录的参数,但它似乎对该字段没有影响.奇怪的是,它没有抛出任何异常,服务电话根本不会抱怨.一切似乎都很正常,除了字段没有更新.

以下是我们代码的相关部分;

// Retrieving the social profile record with all it's columns
Entity socialProfile = GetSocialProfileByName(socialProfileName);

double score = 0;
string scoreField = "influencescore";

// If socialProfile contains our attribute, set it appropriately, otherwise add the attribute
if(socialProfile.Contains(scoreField)) 
{
    score = socialProfile.GetAttributeValue<float?>(scoreField).GetValueOrDefault(0) + 10; // Add 10 to the existing score.
    socialProfile[scoreField] = score;
}
else 
{
    socialProfile.Attributes.Add(scoreField, 10);
}

// Update the record.
service.Update(socialProfile);
Run Code Online (Sandbox Code Playgroud)
  • 社会关怀框架是否允许InfluenceScore外部更新?
  • 如果是这样,那么正确的方法是什么?

小智 2

我查看了socialprofile实体的元数据,发现influencescore属性的IsValidForUpdate属性设置为False。但它可以在创建时设置(即 IsValidForCreate 为 True)。