Docs

Subscriptions Articles & FAQ

account, Hierarchy

461783

2020-12-09T15:10:42Z

2020-12-09T15:12:34Z

0

0

0

249098

Using account Hierarchy with Chargebee.

Using account Hierarchy with Chargebee. 

This article covers 

How to check the hierarchical relation between accounts.

How to check the parent or child accounts.

How to check the invoicing and payment set up in a hierarchy.

When was the hierarchy created or modified?

Summary

We could use the “hierarchies” table for getting the hierarchical details. Lets consider an example, of one parent with two childs.

  1. How many relations a customer record has?

    Use the customer handle and search the hierarchies table. You will be able to see two columns “hierarchies.lft” and “hierarchies.rgt”.

  2. Hierarchies.lft - This column starts with a value of “1” (which means no parent records). If the value is “1”, it means the customer record does not have a parent. If the value is “2”, it means there are two parent accounts in the hierarchy above this customer and so on.

  3. Hierarchies.rgt - This column starts with a value of “4” (which means no child records) and adds 1 to the value for every child account it has. For example if the customer record has two child accounts the value would be “6”. If the customer has one child account the value will be “5”.

  4. What is the parent account of a customer?

You can use the “hierarchies.parent_id” column to check. If there are no parents for the customer the column will be empty.

  1. What is the child account of a customer?

We do not have a column to identify the child accounts. Only parent relations can be established with our DB. However, you can use the “hierarchies.rgt” column to confirm if the customer record has any child accounts as mentioned above.

  1. What is the invoicing and payment set up for a customer?

You could use the “hierarchies.invoice_owner_id” and “hierarchies.payment_owner_id” columns.

  1. When was the hierarchy set up or last edited for a customer?

You could use the “hierarchies.created_at” and “hierarchies.modified_at” columns for this.

The “hierarchies.rgt” column will add a value of 1 to the count if the invoicing and payment set up has two different accounts.

Was this article helpful?
Loading…