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.

Reply
  • 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.

Children