field
The field Instruction copies a value from the input Record to a Name in a Destination.
As it is the most common Instruction, the action property may be omitted.
source |
The property in the input Record. |
destination |
The Destination to store the value in. |
name |
The Name within the Destination to store the value in. |
multivalue |
(Optional) If true, then the value is added to a multi-value name instead of replacing any existing value. |
In addition, value conversion properties can be added, especially value filters, date formats, value mapping, and ref mapping.
Example: single value
To set username within the user Destination using the value of the ID property in the input Record:
{
"source": "ID",
"destination": "user",
"name": "username"
}
Example: mapping to ref
To set an organisational unit in the user’s profile, mapping a code from the input:
{
"source": "orgUnit",
"destination": "profile",
"name": "example:attribute:organisational-unit",
"refMapping": "organisational-unit"
}
Example: working with multi-values
By default, new values are added to existing values in multi-value Names instead of replacing them. To replace the existing values instead, use a remove-values Instruction, demonstrated in this example.
First, this example removes existing values in the job title field of profiles. Then it uses the if-value-one-of Instruction so that, if the profile’s role is researcher, the title “Additional job title” should be added with the set-value action. Finally, it adds a additional job titles from the corresponding source in the input Record using a field Instruction.
{
"action": "remove-values",
"destination": "profile",
"name": "std:attribute:job-title"
},
{
"source": "ROLE",
"action": "if-value-one-of",
"values": ["RESEARCHER"],
"then": [
{
"action": "set-value",
"destination": "profile",
"name": "std:attribute:job-title",
"value": "Additional job title",
"multivalue": true
}
]
},
{
"source": "JOB_TITLE",
"destination": "profile",
"name": "std:attribute:job-title",
"multivalue": true
}