Copy Process Management Settings to Another App
Overview
This article introduces how to copy the process management settings of a Kintone App to another App, with a click of a button.
Sample Image
A button to copy the Process Management settings is placed in the record list view of the Expense Report App. When the button is clicked, an alert dialog will be displayed, and the Process Management settings will be copied to the destination App.
The below screenshot shows the Process Management settings before the settings have been copied over.
The below screenshot shows the Process Management settings after the settings have been copied over.
Prepare the Apps
Two Apps are used in this article. One App holds the process management settings that will be copied. The other App is the destination App to copy the settings to. This article will use the following Apps:
- Expense Report App: The settings will be copied from this App. The App is created from the Kintone Marketplace .
- New App: The settings will be copied to this App. This App will be made from scratch .
Create the Expense Report App
Search and add the Expense Report App from the Kintone Marketplace . The following workflow is set automatically in the process management settings of the Expense Report App when it is created.
Image of the workflow
Open the Process Management settings page in the Expense Report App and delete the "Approver" and "Employee" user fields from the Assignee List option. This is necessary because these fields cannot be copied over to the destination App.
Create a New App
Create an App that includes any types of fields. Save the form when finished and navigate to the Process Management settings. Check the first check box to enable the process management settings. This will create the default workflow shown below:
Sample Code
Prepare the following JavaScript code in a text editor. Replace the value of COPY_APPID
with the App ID of the destination App.
Navigate to the Expense Report App and upload the file into the Upload JavaScript for PC option of the
JavaScript and CSS Customization settings
.
|
|
Save the settings and Update the App. Navigate to the Record List page. A button should be displayed above the list of records. Click on the button to start the process for copying over the process management settings. After the process completes, navigate to the destination App, and check the process management settings. The process management settings should be updated with the new settings.
Code Explanation
The code uses the following 4 steps to copy the Process Management settings of the Expense Report App and deploy them to the Process Management settings of the New App:
- Place a button in the list view of the Expense Report App to trigger the code
- Retrieve the Process Management settings from the Expense Report App
- Update the settings of the destination App (the New App) with the settings retrieved in step 2
- Apply the pre-live App settings of the destination App (the New App) to the live environment
1. Place a button in the list view of the Expense Report App to trigger the code
A button is placed in the Record List page, above the list of records. Clicking the button runs the processes 2, 3 and 4 using promises.
|
|
2. Retrieve the Process Management settings from the Expense Report App
Refer to the Get Process Management Settings API documentation for details on how to retrieve the Process Management settings from an App.
|
|
3. Update the settings of the destination App (the New App) with the settings retrieved in step 2
Refer to the Update Process Management Settings API documentation for details on how to update the destination App, New App, with the settings retrieved in step 2.
|
|
4. Apply the pre-live App settings of the destination App (the New App) to the live environment
Step 3 updates the App settings, but these are not applied to the live environment until the Deploy App Settings API is used. Refer to the Deploy App Settings API Documentation for details on how to reflect the contents updated in step 3 onto an operational environment.
|
|