Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

See Inbound Mapping and Mapping pages for the details.

Primary Accounts

There is one common use case for inbound multiaccounts. HR systems often have a concept of primary record. A person may have several records in the HR system, but one of them is primary. In that case we want to synchronize important data from the primary account only and we want to ignore all other accounts. This can be achieved by setting mapping conditions to make the mapping active only for the primary account. However, as the inbound accounts are synchronized one-by-one, non-primary accounts will result in generating no values, hence removing all values from the user. This can be fixed by a clever use of mapping range:

Code Block
languagexml
<resource>
    ...
    <schemaHandling>
        <objectType>
            ...
            <multiplicity>
				<maxOccurs>unbounded</maxOccurs>
                ...
			</multiplicity>
            ...
			<attribute>
                <ref>ri:lastName</ref>
                <inbound>
                    <target>
                        <path>$focus/familyName</path>
                        <set>
                            <condition>
                                <script>
                                    <code>
                                        if (basic.getAttributeValue(projection, "primary")) {
                                            // Primary account. We want to remove all values, except those given by this mapping.
                                            // Which means that we want range to be "all".
                                            // Therefore we return true for every value of the target set,
                                            // which means that all values will be part of the range.
                                            return true
                                        } else {
                                            // Non-primary account. We want to keep all existing values of target property (familyName).
                                            // Which means that we want range to be "none".
                                            // Therefore we return false for every value, which means no value will be part of the range.
                                            return false
                                        }
                                    </code>
                                </script>
                            </condition>
                        </set>
                    </target>
                    <condition>
                        <script>
                            <code>basic.getAttributeValue(projection, "primary")</code>
                        </script>
                    </condition>
                </inbound>
            </attribute>
            ...
        </objectType>
    <schemaHandling>
    ...
</resource>

The example assumes that there is a boolean account attribute primary that will be set to true for exactly one HR account. The primary attribute is used in the mapping condition, which makes the mapping to be activated only for primary HR account. There is also a definition of mapping range, which is using a dynamic expression to determine the range. This effectively applies range of all for primary accounts and range of none for non-primary accounts.

The effect of this setup is that the value of familyName will be taken only from the primary HR account.

Outbound Mappings

Info
titleMidPoint 4.2 and later

...