For users in Communities, we want to change their User reputation points with code (Apex). How do I do this?
2 Answers
I did this during a migration from JiveX to Salesforce Community Cloud. You can use the Chatter API (ConnectApi) with Apex to achieve what you're doing. I assume you mean Apex when you say code?
You can use the Chatter API (ConnectApi) ConnectApi.Reputation class. It has two descriptive properties:
- reputationLevel (a reference to a ConnectApi.ReputationLevel), and
- reputationPoints (a Double that holds the actual number of points the user possesses)
as well as a String property that contains a URL to the reputation.
Additionally, there is a ReputationPointsRule class that contains information on the out-of-box activites that award points.
In addition to Bri's answer (which I recommend), there is an alternative to using the ConnectApi, which is to update the NetworkMember record for a user directly in apex. ReputationPoints is a field that resides on NetworkMember and is updateable.