Announcement

Collapse
No announcement yet.

Determining whether Business Account is in an Availability Group

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Determining whether Business Account is in an Availability Group

    We're using Business Accounts for customers who have locations throughout the country and it's working out really nicely. We'd like to show/hide Pages/features of our site according to whether the customer's Business Account has been assigned to an Availability Group.

    For instance, one of our customers has about 80 locations. Each of those locations has a Customer Account, with all of those accounts added to one central Business Account. That Business Account is assigned to an Availability Group (and Price Group). In a page template, when I check to see if one of those customer's belong to the Availability Group it returns false, even though their Business Account is assigned to the Availability Group.

    I would prefer not to assign each sub-customer/location to the same availability group as the Business Account, as these Availability Groups will change quarterly, and it's far easier to change Availability Groups at the Business Account level.

    Can anybody suggest how I might figure out in a page template whether a specific Availability Group has the customer's Business Account assigned to it, or alternately, to figure out which Availability Groups a Business Account is assigned to? I couldn't find any mention of this in the developer docs.

    Thanks!
    Charlie Morrison
    www.MCRmedical.com

    #2
    If you have the customer assigned to the Business account can you just check if they are assigned to that? Or is there a reason you need the availability group information?

    Here is a snippet you can use to check if the customer is assigned to the business account: https://snippets.cacher.io/snippet/b3188a3c43e4aec7b445

    Otherwise here is a snippet that answers this:

    Originally posted by mcrmedical View Post
    Can anybody suggest how I might figure out in a page template whether a specific Availability Group has the customer's Business Account assigned to it
    https://snippets.cacher.io/snippet/3bf7b529e20f3af82bd3

    Let me know if you have issues implementing the code.




    ​​​​​​​
    Nicholas Adkins
    Technical Training Specialist / Miva, Inc.
    [email protected]
    https://www.miva.com/mivalearn

    Comment


      #3
      Hi Nick!
      That is perfect! Thank you!

      The reason we're checking the Business Account against the Availability Group(s) instead of whether the Customer is in the Business Account is because the same Availability Group may be tied to several different Business Accounts and we'd rather hard code one Availability Group instead of multiple Business Accounts, which will change over time.

      Thanks again. I really appreciate you taking the time to share those code snippets. Exactly what we needed.

      Charlie
      Charlie Morrison
      www.MCRmedical.com

      Comment

      Working...
      X