Question
We are creating a script that uses the Kintone Connector to obtain a CSV file that matches the Kintone record structure and add it to a Kintone record.
The script repeats the following process for the number of records (rows) in a CSV file.
(1) Stores the records of the target row in the csv file in a script variable
(2) Obtains the target record in Kintone from the key code (A) in the CSV file
(3) Updates the original Kintone value if the csv file is an empty string or the value in the CSV file if the file is not empty to the target record in Kintone
In order to prevent all files from being updated in Kintone if there is even one error in the CSV file, such as if the key code (A) does not exist in Kintone in the step 2, the above loop process is enclosed in a transaction process. However, as shown below, the update process is performed at the first line of the csv file.
1st line of CSV file: Kintone key code -> Update
2nd line of CSV file: no Kintone key code -> error processing
We thought that since we set up a transaction before the loop process, it would be rolled back without committing until the loop was finished, but it is not rolled back. What can be the reason for this?
The current script flow is shown below.
Answer
The cause can be that the Update Record operation of Kintone Connector does not support transactions and not being rolled back and does not work as expected.
Please refer to the following manual page for Update Record operation.
Update Record - Kintone
https://www.hulft.com/help/en-us/HULFTSquare/Content/Designer/Connector/kintone_update_record.htm
As you want to branch processing based on whether or not there is even one error in the CSV file, consider preparing a process to check whether or not there are any error records in the CSV file before looping to update the target record and branches processing based on whether or not there are error records.
In this case, the process of checking the contents of the CSV file and the process of updating the target record in Kintone refer to the same csv file, therefore it is necessary to ensure that the contents of the csv file do not change between the two processes.
Comments
0 comments
Article is closed for comments.