Customize

Get Belonging Organization of Selected User

Summary

Get the organization to which the user selected in the field belongs.

Usage

When this action is executed, the information of the department to which the user selected in the user selection field belongs will be saved as the result of the action. If the user belongs to multiple departments, all of them will be retrieved.

If multiple users are selected in the user selection field, the belonging departments of all those users will be retrieved. When multiple users belong to the same department, the same department will appear more than once in the result values.

It is possible to reference this information from $1 using an expression, but a more typical usage is to combine it with “If user belongs to the specified group or organization.”

To refer to the result using an expression from other actions, refer to the “Response” section in Cybozu’s documentation for the result data structure.

For example, to get the department name of the first affiliated department, write as follows:

= $1.organizationTitles[0].organization.name

To set the acquired departments in the field of “Set Field Value” or in the department selection field in the field mapping, write as follows:

= $1

Parameters

Set User Selection Field and Target Field (Optional).

User Selection Field

Specify the field in which a user has been selected.

This parameter accepts the following field types:

  • User selection
  • Created by
  • Updated by
  • Assignee

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 the result will be obtained with organizationTitles being empty.

Target Field (Optional)

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:

  • Text
  • Text area
  • Rich text
  • Department selection

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 department names will be set as a comma-separated list.

Compatibility with krewSheet

This action is designed to work seamlessly with krewSheet.

If the Target Field (Optional) is specified without omission, it is only supported under the following conditions:

However, there are the following restrictions:

  • The results cannot be assigned to a field that was retrieved through a Lookup.
  • The following field types can be set only at the timing of record saving (e.g. “Before Record Saved Excluding Deleted"): If you want to gain more technical knowledge, refer to the krewSheet documentation .
    • Fields not included in the krewSheet view’s columns
    • Fields set to read-only in krewSheet
    • Rich text field

If you omit the “Target Field (Optional)”, it will support regardless of the conditions.

Restrictions

  • In a parent-child relationship within the department, when the child department does not belong to the parent department, only the child department will be acquired.

  • If the user is a guest user, they will be treated as not belonging to any department.

  • 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 details screen.

    • New record screen
      • Available for use at any time
    • Edit record screen
      • Available for use at any time
    • Inline editing mode on PC (after clicking the pencil icon to enter editing mode)
      • Available only on “Before Record Saved.”