Hi,
I’m trying to rename all attachments from the workflow script.
The goal is to iterate over the rows in the table and use the “id” column as a part of the attachment name.
I’ve tried a few approaches and now I have feeling, that the property fileName is simply read-only.
Here is one of my code snippets, which works with other column values, but the attachments is not changing without any error message:
(async (doo: IDoo) => { // do not change this line
// place your code here
const data = await doo.table.getData<IDooApiTableANY>('tablename')
const arrData = Object.keys(data.data);
for (const dkey of arrData) {
const picObjects = Object.values(data.data[dkey].fields.obrazky);
const picIterator = Object.keys(picObjects);
for (const pkey of picIterator) {
picObjects[pkey].fileName = dkey + "NEW" + pkey;
}
const MyUpdate = await doo.table.updateFields('tablename', data.data[dkey].id, {obrazky : picObjects});
}
Where “obrazky” means the array of attachments.
The next step is to download and remove all attachments. The download script is ready, but the removal is still open to solve.
Any help will be appreciated.
Thanks a lot,
V.