Manager-Level Group Bonus Logic

Hope you’re doing well!

I’m working on a referral-based app in Glide, and I’ve hit a wall trying to implement something I think you might be able to help with.

What I’m Trying to Build:

I have a referral tree where:

  • Users can refer other users (forming a branching structure).

  • Any user can be manually promoted to Manager (there are no fixed criteria).

  • When someone becomes a Manager, they become eligible for a Group Sales Bonus (GSB) — which is 5% of all approved package sales from users in their team.

Here’s the twist:

A Manager’s team should include:

  • All users under them in the genealogy,

  • But stop at the next Manager(s) below them — like a breakaway structure.

Once a new Manager appears down the line, they start their own team, and the GSB bonus for the upline Manager ends before that.


What I Need Help With:

  • Figuring out how to trace a Manager’s team down the referral tree, stopping when a Manager appears.

  • Making sure each user is linked to the correct Manager who should receive the GSB for their sales.

  • Calculating 5% of approved package sales from each Manager’s team, and storing it in a separate “GSB Wallet.”


What I’ve Tried:

  • I already have unilevel logic working (Levels 1–3) using relations and lookups.

  • I’m considering tagging each user with their “real” manager (first manager above them), but since Glide doesn’t support recursion, I’m unsure how best to do this.