Auto-assign Users when Adding Records
Contents
Overview
This article introduces how to auto-assign a user in a Kintone App's record, after the record has been added. With Kintone's default features, only the creator of the record can be auto-assigned.
Sample Image
When a new record is added, the Update Status API is called. It uses the value saved in the User selection field, proceeds to the next status, and assigns that user.
Prepare the App
Create the form
Create an App
with the following fields and settings.
Field Type | Field Name | Field Code | Notes |
---|---|---|---|
User Selection | Approver | Approver | |
User Selection | Employee | Employee | This field is used for Process Management. |
Place any other fields in this App.
Set the process management settings
The Process Management Settings for the App must be enabled for this code to run.
In the settings of the App, navigate to App Settings, then to Process Management.
Check the "Enable process management" checkbox. Make any necessary updates to the Status Settings option. For the Process Flow Settings, navigate to the row that includes the status that comes after the default status. Choose Add a field for selection, and then select the User Selection field that will contain the user that will be auto-assigned.
Save the settings, and click on Update App to apply the changes to the Kintone App.
Example Settings when assigning only 1 user
Set Process Management settings
with the following.
-
Status
Before submission (Draft), Submitted, Approved, Send back -
Process list
Status Assignee Action Next Status Before submission (Draft) Created by Submit Submitted Submitted User chooses one assignee from the list to take action: Approver - Approve
- Send back
- Approved
- Sent back
Sent back User chooses one assignee from the list to take action: Employee Re-submit Submitted
Example settings when assigning multiple users
Set Process Management settings
with the following.
- Status
Before submission (Draft), Submitted, Approved, Send back - Process list
Status Assignee Action Next Status Before submission (Draft) Created by Submit Submitted Submitted One assignee in the list must take action: Approver - Approve
- Send back
- Approved
- Sent back
Sent back User chooses one assignee from the list to take action: Employee Re-submit Submitted
Sample Code
If assigning only 1 user
This sample code assigns the first user listed in the User Selection field.
|
|
If assigning multiple users
This sample code assigns all users listed in the User Selection field. In the Process Management settings, set the "Assignee List" of the status to "All assignees in the list must take action".
|
|