May 13, 2022 08:49 AM
Hi,
I want to be able to upload documents in one table. These documents are usually invoices and should be uploaded to the correct supplier. When I upload a new document, I want to create a new record in a different table, for each attachment that is being uploaded.
Currently, when I run it it creates a new record but the new record contains previous uploaded attachments too. How can I ensure that it is only the latest uploaded attachment that is being created as a new record?
When I bulk upload, it also creates only one record. How can I make sure that it creates one record for each attachment that is being uploaded?
Here is the current trigger:
Here is the current action:
Solved! Go to Solution.
May 13, 2022 02:39 PM
Hi,
you can apply ‘low-code’ approach. to get last element of array, use method ‘pop’.
between trigger and ‘create record’, install simple script step.
You should pass this array, as input parameter with any name (I used ‘urls’)
input parameters located in ‘input.config()’
then you should pass output element, assigning it to some variable. you can use this variable in next steps.
so:
const single=input.config().urls.pop();
output.set(‘url’,single);
that’s how similar setup looks like:
after that, use this variable ‘url’ in further steps, as you usually do with values.
Actually, you can do the same without code by creating additional mini-table with extracting last url from array, by text formulas, and then at next step take your value. But I think solution without extra table is better.
May 13, 2022 02:39 PM
Hi,
you can apply ‘low-code’ approach. to get last element of array, use method ‘pop’.
between trigger and ‘create record’, install simple script step.
You should pass this array, as input parameter with any name (I used ‘urls’)
input parameters located in ‘input.config()’
then you should pass output element, assigning it to some variable. you can use this variable in next steps.
so:
const single=input.config().urls.pop();
output.set(‘url’,single);
that’s how similar setup looks like:
after that, use this variable ‘url’ in further steps, as you usually do with values.
Actually, you can do the same without code by creating additional mini-table with extracting last url from array, by text formulas, and then at next step take your value. But I think solution without extra table is better.
May 13, 2022 05:45 PM
Keep in mind that this method of extracting urls using a formula field will likely break in November when urls of attachments undergo a change.
May 15, 2022 10:08 PM
Yes, you are right, it probably break, But I think that’s the least of concern with November change. I think, significant part of such scripts/automations will lose their sense of existence. Some customers even can decide to change platform. Unless there will some simple and obvious way, to preserve their valuable documents, on the moment of change and later. I mean obvious for management squad, with 'User"/“Power user” level of understanding tech side.
May 16, 2022 12:28 AM
Hi Alexey,
Thank you so much for providing this solution. Worked like a charm.