Skip to content

Conditionals & Exclusions

AP Orlebeke edited this page Jun 26, 2020 · 8 revisions

You can refer to the descriptions for pfm_conditionals pfm_exclude on the Manifest Format wiki.

Several example conditions can be found here.

Purpose

The pfm_conditionals and pfm_exclude keys allow you to incorporate logical rules with your preferences. This creates relationships that tie one or more preferences together based on:

  • The presence / absence of one or more preferences
  • The desired or undesired value(s) of one or more preferences

Target Keys

With either pfm_conditionals or pfm_exclude, there is always a pfm_target which identifies the key that the rule should be linked to. Typically, this is simply the same pfm_name value as the preference key to be linked. However, this is NOT the case for preferences that live within dictionaries.

When a pfm_target is for a preference that lives within a dictionary, both the dictionary and the preference key name need to be identified. This is accomplished by entering the following for pfm_target:

<dictionary_pfm_name>.<preference_key_pfm_name>

Refer to example #4 under Example Conditions

Conditionals

The pfm_conditionals key allows you to define values that when met will forcibly add other preferences to your payload.

Whereas when a preference is added by clicking the adjacent + symbol and can be removed again by clicking the x symbol, when a preference is added that references others within pfm_conditionals these other preferences are added automatically and cannot be removed individually. Only the preference which triggers the conditional rule(s) can remove other preferences added in this manner.

Exclusions

The pfm_exclude key allows you to define rules that will present warning(s) with the preferences and/or values that are causing the exclusion rule(s) to be met. If the payload is exported and the exclusion(s) are left unresolved, the offending preference(s) will be forcibly excluded from the created profile.

Format

The format for both conditionals and exclusions are nearly identical. See Manifest Format for options & details and the Example Conditions

Logical AND, not OR

In both cases, conditional and exclusion rules are additive. This means that when one or more rules are added to the same pfm_conditionals or pfm_exclude array of dictionaries, all rules must be satisfied. You cannot, for example, have a preference be excluded based on the absence of one preference OR the value of another.

Limitations

There are some complex preference behaviors that simply aren't possible to replicate with pfm_conditionals and pfm_exclude.

If you run into a roadblock, reach out in the #profilecreator MacAdmins Slack channel.

In some cases, you may be able to only partially accomplish the desired behavior and will need to illustrate the rest in the pfm_description.