Using Conditional Logic in Assignment Maps

Prev Next

Assignment Maps provide a powerful and flexible way to manage your Apple device fleet through conditional logic. This guide will help you understand how to effectively use if/else statements and conditional blocks to create sophisticated deployment strategies tailored to your organization's specific requirements.

If/else logic in Assignment Maps allows administrators to create conditional pathways that determine which configurations, apps, and settings get deployed to specific devices or users. This conditional logic works on a simple premise: "If a condition is true, then apply these settings; otherwise (else), apply different settings." This powerful functionality enables you to make deployment decisions based on device attributes, user information, or other organizational criteria.

The fundamental structure of if/else logic in Assignment Maps mirrors programming concepts but is presented through an intuitive visual interface. When a condition is evaluated, the system checks if it's true. If it is, the associated actions are performed, and no further conditions in that block are checked. If it's false, the system moves to the next condition ("else if") or to the default action ("else") if all conditions are false.

Conditional blocks are the building blocks of logical decision-making in Assignment Maps. They contain sets of if/else conditions that determine which configurations to apply based on device or user attributes. These blocks are organized on an infinite canvas, giving you complete flexibility to create detailed deployment strategies for your entire organization.

Each conditional block follows a specific evaluation flow. When a device checks in, the system evaluates the conditions in the order they appear. Once a condition evaluates to true, the system applies the associated configuration and moves to the next conditional block without checking any further conditions in the current block. This ensures that only the most relevant configuration is applied based on the first matching condition.

  • If/Else Conditions: The foundation of conditional blocks, these conditions group similar criteria together to create cleaner, more organized maps. Each condition is evaluated in order, with the first matching condition being applied.

  • Assignment Nodes: These are the logical conditions using Assignment Rules contained within Conditional Blocks. Assignment nodes define the specific criteria that must be met for a condition to evaluate as true. They can reference device attributes (such as model, OS version, serial number) or user attributes (department, location, role). Multiple conditions can be combined using AND/OR operators to create complex logic.

  • Root Line: The Root Line ensures that all Conditional Blocks connect back to the main flow, avoiding dead ends in your Assignment Map. This visual element helps you maintain a clear understanding of how devices will navigate through your conditional logic.

Assignment Map conditional logic supports the following inputs, operators, and values:

Input

Operators

Example Values

Enrollment Type

is

is not

Automated Device Enrollment

Manual Device Enrollment

Chip type

is

Apple Silicon

Intel

FileVault

is

On

Off

Supervision status

is

Supervised

Not Supervised

Mac family

is one of

is not one of

iMac

iMac Pro

Mac Pro

MacBook

MacBook Pro

MacBook Air

Mac mini

Mac Studio

Tags

are exactly

are not exactly

contain one of

does not contain one of

Test

Pilot

Production

Asset Tag

is

is not is one of is not one of

contains

does not contain

contains one of

does not contain one of

Honolulu

123987

DEN-123845-MBP

Serial Number

is

is not

is one of

is not one of

contains

does not contain

contains one of

does not contain one of

QCM2XXXXXX

OS version

is

is not

is greater than

is less than

is greater than or equal to

is less than or equal to

is between

12

13.1

16.2.2

User Email

is

is not

is one of

is not one of

contains

does not contain

contains one of

does not contain one of

admin@accuhive.io

User Group

is one of

is not one of

database-admins

User Job Title

is

is not

is one of

is not one of

contains

does not contain

contains one of

does not contain one of

Product Engineer

User Department

is

is not

is one of

is not one of

contains

does not contain

contains one of

does not contain one of

Product

Editing an Assignment Map in a Blueprint triggers an immediate reevaluation of all rules.

  1. For new or simple Assignment Maps without existing conditional logic, click the + Add conditional logic button when editing your Assignment Map.

  2. For Assignment Maps with existing conditional logic, click the + button to add a new Conditional Block within your canvas.

  3. Once you've added a conditional block, you'll need to configure the Assignment Rules that should apply to each condition.

  4. Click the pencil icon within the conditional block to configure the Assignment Rules that should apply to the If condition.

  5. Continue adding Library Items that you want to apply to the conditions defined in your If, Else, and Elseif statements in your conditional blocks.

  6. You can continue adding and configuring an infinite amount of conditional blocks using the + buttons on each Assignment Node.

Assignment Rules define the specific criteria that must be met for a condition to be evaluated as true. These rules can be based on various attributes:

  • Device attributes (model, OS version, serial number)

  • User attributes (department, location, role)

  • Custom attributes specific to your organization

When configuring Assignment Rules, you can combine multiple criteria using AND/OR operators. For instance, you might create a rule that targets "MacBook Pro devices AND running macOS Ventura AND in the Marketing department".

To add additional pathways within a conditional block, click the + button to add an else if condition and configure Assignment Rules for that pathway. This allows you to create multiple branches within a single conditional block, each with its own set of configurations.

Conditional Block: Software Deployment 
If (Department equals "Marketing") 
   - Install Adobe Creative Cloud 
   - Install Figma 
   - Install Slack 
Else if (Department equals "Engineering") 
   - Install Visual Studio Code 
   - Install GitHub Desktop 
   - Install Docker 
Else if (Department equals "Finance") 
   - Install QuickBooks 
   - Install Excel Add-ins 
   - Install Financial Reporting Tools 
Else 
   - Install Basic Office Suite
Plain text

In this scenario, devices are evaluated based on the user's department. The first matching condition is applied, and the appropriate software is installed accordingly.

Conditional Block: Security Configurations 
If (User Group equals "Remote" AND Role contains "Executive") 
   - Apply Strict VPN Configuration 
   - Enable Enhanced Security Monitoring 
   - Require Biometric Authentication 
Else if (Location equals "Remote") 
   - Apply Standard VPN Configuration 
   - Enable Basic Security Monitoring 
Else if (Location equals "Office" AND Role contains "Executive") 
   - Enable Enhanced Security Monitoring 
   - Require Biometric Authentication 
Else 
   - Apply Standard Security Configuration
Plain text

This configuration applies different security settings based on whether a user is remote or in-office, with additional considerations for executive roles.

Conditional Block: OS-Specific Configurations 
If (OS Version greater than or equals "14.0") 
   - Apply macOS Sequoia Optimizations 
   - Install Sequoia-Compatible Apps 
Else if (OS Version greater than or equals "13.0") 
   - Apply macOS Sonoma Optimizations 
   - Install Sonoma-Compatible Apps 
Else 
   - Apply Legacy OS Configurations 
   - Schedule OS Update Notification
Plain text

This scenario ensures that devices receive configurations and apps that are compatible with their current operating system version.

The search field near the top left of the Assignment Map allows you to search by Library Items, rules, or look up a device or user.

Entering a specific Library Item, or a rule, will locate and highlight the item on the Assignment Map. This can be useful when there are many items on the map, making it difficult to locate.

  1. Enter the name of the Library Item in the search field, and click Jump to.

  2. The selected Library Item will be highlighted in the Assignment Map.

  3. Clicking the x in the search field will clear the highlighted Library Item.

Looking up a device will allow you to see the device’s path through the map's logic. This is useful way to troubleshoot the logic and ensure that the device has all of the expected Library Items in its path. When searching by user, you can select any of the devices assigned to that user.

  1. When viewing a Device Record, you can click the magnifying glass next to the Blueprint name to look up the device on the Assignment Map.

  2. When viewing an Assignment Map, you can enter any device detail, such as serial number, device name, or the user that is assigned to the device.

  3. Once the device has been selected, the Library Items that will be assigned to the device will be highlighted.

    • It is expected behavior that the Automated Device Enrollment Library Item will always be greyed out, as it is not evaluated for conditional logic, and always applies for eligible devices. You can view the status of Automated Device Enrollment assignments in the Enrollment section from the left-hand navigation.

  4. Clicking Exit device look up will return you to the default Assignment Map view.

When building complex Assignment Maps, organize your conditional blocks into logical groups. For example, group all department-based conditions together, and all location-based conditions together. This makes your Assignment Map easier to understand and maintain over time.

Creating a clear visual hierarchy helps you and your team understand the flow of logic. Use meaningful names for your conditional blocks and position them logically on the canvas.

Before deploying changes to your production environment, thoroughly test your conditional logic. Use the device or user lookup feature to see the path a device took through the map. This helps identify any issues with your conditional logic before they affect your users.

Remember that editing an Assignment Map triggers an immediate reevaluation of all rules. This makes it easy to test changes, but also means you should be careful when making modifications to production Assignment Maps.

While Assignment Maps support complex conditional logic, aim for the simplest solution that meets your needs. Overly complex conditional logic can be difficult to maintain and troubleshoot.

Consider breaking very complex logic into multiple Assignment Maps if it makes your deployment strategy clearer and more manageable. You can still achieve the same results while maintaining better organization.

Create documentation that explains the purpose and logic of your Assignment Maps. This is especially important for complex maps with many conditional blocks. Documentation helps ensure that your deployment strategy is understood by your entire IT team, even those who weren't involved in creating it.

When selecting a Library Item on an Assignment Map in Edit mode, you can exclude specific devices for that item. These exclusions apply across the map wherever the Library Item appears, making it seem as if the item is not relevant to the excluded device(s). Library Items with exclusions are marked with a new badge on the map, and you can find a list of all excluded items in the upper-left corner. Additionally, these exclusions are highlighted when using Device Lookup.