Get the primary department of the user selected in the field belongs.
When this action is executed, the information of the primary department to which the user selected in the User selection field belongs will be saved as the result of the action. It will be in array format for the number of users selected in the field. If the selected user has not set a priority department, the corresponding element of the array will be empty (null).
For example, if three users A, B, and C are set in the user selection field, the result value will be in the form of [A’s primary department, B’s primary department, C’s primary department].
If you refer to the results using expressions from other actions, the structure of the department information will be the list of “Organization type” described in Cybozu’s documentation .
For example, to obtain the departments name of the primary department of the first selected user, it would be as follows:
= $1[0].name
To set the acquired departments in the field of “Set Field Value” or in the group selection field in the field mapping, write as follows:
= $1
Set User Selection Field and Target Field (Optional).
Specify the field in which a user has been selected.
This parameter accepts the following field types:
When selecting fields in the table, retrieval will be performed for each row. However, in this case, if you try to reference the result of the action with an expression like $1, it becomes uncertain which line’s result will be returned. To perform processing on each row in the table, specify Target Field (Optional).
If no users are selected in this field, it will not result in an error and an empty array will be obtained.
Use this parameter to set the results to another field. You can omit this parameter if you do not set the results directly in the field but use it in another action.
This parameter accepts the following field types:
When specifying fields within a table, the “User selection field” must also select a field from the same table.
When the destination is set to a departments selection field, the currently selected other departments will be cleared, and the department obtained from “Get Primary Organization of Selected User” will be selected. If multiple departments are obtained, all will be set.
When the set destination is a Text field, the department name is set. If multiple departments are obtained, the group names will be set as a comma-separated list.
Some conditions are compatible.
If the Target Field (Optional) is specified without omission, it is only supported under the following conditions:
However, there are the following restrictions:
If you omit the “Target Field (Optional)”, it will support regardless of the conditions.
If the selected user is a guest user, that user’s priority department will be treated as nonexistent.
When setting Target Field, it can be used on any of the following screens. If used on other screens, it will result in an error during app execution. When the “Target Field” is omitted, it can be used on other screens, such as the record detail screen.
The action of “Get Primary Organization of Selected User” cannot be set for the “user’s belonging group/department” parameter of the series of judgment conditions of belongings such as “if belonging to the specified group/organization.”