Trying to change a field of another user

Hi All.

I’m trying to build a simple affiliate program for my web app.
If a user (let’s call him X) is referred by another one (let’s call him Y), I would like to increase the number of sign-ups brought/ referred by user Y.
So, in the sign-up workflow I added this step:

Y’s affiliate ID is stored in its “Current User” thing as affiliateID.
X’s refferedby is saved in its “Current User” thing, too and represents the affiliate ID of the person who sent him/ her to my app (Y in this case).
X will have a cookie that contains Y’s affiliate ID.
And I want to increase Y’s affiliatesignups with 1 when X is referred by Y and sign-ups in my app. To do this, I’m searching user X after the affiliateID and modify its affiliatesignups field by increasing its value with 1.
However this doesn’t work. What am I doing wrong?

Hi there, @mishalobdell23… I don’t know anything about having a cookie contain Y’s affiliate ID, so if the issue is related to that part of the feature, I wouldn’t know it. That being said, the first thought that came to mind when I read your post is privacy rules. Do you have the default rule set on the User data type (the rule is This User is Current User)? If that rule is in place, it could definitely be stopping the system from finding the user in the search.

Hope this helps.

Best…
Mike

Thanks a lot for your answer @mikeloc
This is what I have as privacy rules for the “User” thing (basically, I’ve added a new rule on the User thing for affiliate sign-ups, additionally to the standard This User is Current User)


I’m afraid the rule I’ve established for affiliate sign-ups might not work but I don’t have any idea how could I change it

If it was me… just to see if I could get it working… I would delete the first rule and check the boxes for affiliateID, affiliatesignups, and Find this in searches under Everyone else. If it works at that point, well, at least you know the first rule is causing the issue.

And if you are sure that the privacy rule is not the issue, you might try to remove the cookie condition and see if it will work. The problem might just be from the cookie condition.

It worked! Thanks a lot!

1 Like