
How to set attachment in record one to attachment_field in record two
Ok, here the code I worked on in the last couple hours:
Basically I have property app & property management app. And when something is set in property management, the associated property records should get updated automatically.
I now retrive all the intended recrods that I want and set the property value to the orginal property management value.
BUT!!!! The post has become extremely difficult. If you know a quick solution || examples for this, it is highly appreciated. Thank you!!!
1 comment
Hello Amber,
From what I understand, you want to attach the same file that is attached to a different record.
In other words, when a file is attached to a record in App A, the same file is attached to a record in App B. Correct me if I'm wrong.
Every attachment has a file key that you can use in Javascript.
The flow should be something like the following:
1) Obtain a file key of the attached file from an app using the GET method
2) Download the file with the obtained file key from 1)
3) Get a new file key of the downloaded file
4) Using the file key that you obtained in 3) and the POST method, upload the file to a different app
Examples on how to download/upload a file using a file key are described in
the following pages so please use those pages for your reference:
Kintone Developer Program - Download File
https://developer.kintone.io/hc/en-us/articles/212494468-Download-File
Kintone Developer Program - Upload File
https://developer.kintone.io/hc/en-us/articles/212494448-Upload-File
I hope this helps!