Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot update InfluenceScore on Social Profiles programmatically

We have a newly set-up CRM 2015 On-Premise environment; and we're doing some fiddling with the Social Care framework.

We simply wanted to update a Social Profile record's InfluenceScore parameter within our custom application using a web service call, but it appears to have no effect on the field. Oddly enough, it does not throw any exceptions, and the service call does not complain at all. Everything seems normal, except the field is not being updated.

Here are the regarding bits of our code;

// 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);
  • Does Social Care Framework allow the InfluenceScore to be updated externally?
  • If so, what's the proper way to do it?
like image 460
mehmetseckin Avatar asked Jun 04 '15 14:06

mehmetseckin


1 Answers

I looked at the metadata of socialprofile entity and found out that the influencescore attribute has its IsValidForUpdate property set to False. It can be set on create though (i.e. IsValidForCreate is True).

like image 82
Alessi Avatar answered Oct 15 '22 23:10

Alessi