Points not being awarded in Poll.OnVote automation

I'm trying to create a new Automation rule to award points to a user who votes in a poll but I can't get the points to be awarded. Debugging the code shows that all the values are correct in the award point function, but still no points. 

var userId = context_v2_automationTrigger.Arguments.VotingUserId;
var contentId = context_v2_automationTrigger.Arguments.ContentId;
var contentTypeId = context_v2_automationTrigger.Arguments.ContentTypeId;

if (context_v2_automationTrigger.Event == 'OnVote') {
    core_v2_eventLog.Write("TRIGGER Poll.OnVote", { Category: 'element14 AR', EventId: -1, EventType: 'Information' });
    context_v1_pointsAutomation.AwardPoints(userId, contentId, contentTypeId);
}
core_v2_eventLog.Write("Poll Status: " + context_v2_automationTrigger.Event + " - UserId: " + userId + " - contentId: " + contentId + " - contentTypeId: " + contentTypeId, { Category: 'element14 AR', EventId: -1, EventType: 'Information' });

Member Point rule is setup to use this automation:

Parents
  • Former Member
    0 Former Member

    Are the log messages showing in the Event Log?

    Do you have the Poll.OnVote event selected as a trigger?

    How are you creating and voting in the Poll?

  • Yes I'm seeing both those log messages in the Event Log with userId, contentId, and contentTypeId all having their value set correctly.

    And yes I have the Poll.OnVote event selected.

    Polls are created in wiki pages by using the RTE to "Insert -> Poll". To vote in the poll: you go to the wiki page with the poll in it, click the "Vote" button at the bottom of the poll, select the option you want to vote for and then click "Vote".

    I also have an automation setup to award points when a poll is created and that is working just fine.

  • Former Member
    0 Former Member in reply to wkopala

    I set up your automation locally and it's working to award points on votes. A development note: You likely want to first check ArePointsAwarded, unless you want to award more points every time a user changes their vote on the same poll.

    Are any errors being returned from the AwardPoints call? you can assign the return value to a variable and check .Errors and .Warnings lists. See the studio documentation for context_v1_pointsAutomation.

  • I just did some more testing, and it worked for me locally, also. So checked again in our dev and staging and realized it's only working when you vote in a poll you created. Doesn't work if you vote in someone else's poll. Do I have the wrong value for userId?

  • Former Member
    0 Former Member in reply to wkopala

    I tested both scenarios and saw points for creator and non-creator. What happens in the non-creator scenario? Event log messages appear? Any Errors or Warnings that come back from the AwardPoints call?

  • Had QA help me with testing this more thoroughly and it seems to be an issue with the polls that have been migrated versus newly created polls. The migrated ones don't award the points but the newly created ones do. Not sure if that's a Telligent issue or some weirdness from our migration process.

    I checked the result from context_v1_pointsAutomation.AwardPoints and there are never any errors in there (and never anything in the Exceptions log). There will just be a warning if you vote twice in the same poll.

Reply
  • Had QA help me with testing this more thoroughly and it seems to be an issue with the polls that have been migrated versus newly created polls. The migrated ones don't award the points but the newly created ones do. Not sure if that's a Telligent issue or some weirdness from our migration process.

    I checked the result from context_v1_pointsAutomation.AwardPoints and there are never any errors in there (and never anything in the Exceptions log). There will just be a warning if you vote twice in the same poll.

Children