Adding files from a separate record based on selected options in a Multiple Select field

A little question for the community:

If you have a selection of PDF files stored in a separate Application each to its own record:

You have a different Application to which you want to attach the relevant PDF depending on the Multi-Select options that have been selected:

NOTE: We want the actual files added to the record not just a relationship for user ease.

How would you go about doing it?

We had an issue this morning in that the way we were trying to achieve the goal was not working, I am not sure if it is a bug or just me thinking something should work when it obviously won’t :wink:

Anyway, let’s go into the no-doubt long bit:

Method One

The first way that it was being done which I feel should work is via a series of conditionals:

I feel that whilst this may be a little ‘cumbersome’ it should work but it doesn’t:

Now I can see all sorts of possible issues with doing it this way especially if it is run on change but I would have expected a result closer to what was wanted when run on a preselected record, or what am I missing?

I also tried running the conditionals in a loop for each selection but that had similar results

Method Two

The next way I thought of was to relate the main record to the PDFs and then add the PDFs to the main record by looking at the related records. So I built a similar Workflow to the original one only this time adding relations based on the selection from this I would run a different workflow to pull the PDF files across in one hit.

Again I can see potential issues with doing it this way however as it won’t add a duplicate relation the issues are potentially less.

As seen in my test environment, this method does seem to relate the correct records, so in principle, adding documents may work from that. However, when I was testing this in the live environment, it did not appear reliable, so I never actually moved on to adding the PDF files.

Method Three

The way we fixed it was by looping through the Multiple Select options searching for the relevant PDF record, pushing the file ID into an array and then adding the array to the documents field on the main record thereby overwriting the field with only the files wanted:

Which works and is probably a neater solution:

However, I still feel that the initial option should work even if it is not ideal. To me it feels like the system is not clearing the relevant file id between conditionals therefore it is adding the same file multiple times??

Am I missing something?

I use method three for a few automations. It is very efficient when dealing with a lot of data and does not fill up the activity feed with as many updates in the record.

As for method one, do you think it could be that clear collected should be outside and between the conditionals? As you mentioned, the automation might not clear the relevant file because the condition did not run. Having the clear collected in between might clear the id, even if the condition is false. I will see if I can test it later today.


@Jason I agree that your logic in both Method One and Method Two should work here.
I like the final version better for reasons similar to what @Luis mentioned…but I would also expect the other methods to work.
Haven’t had time to test on this myself yet…but leaning toward this being a bug indeed.


@Luis I managed to test moving the Clear Collected but it makes no difference (the issue is the same without any Clear Collected as well), I would have expected it to work without any Clear Collected at all.

I agree that method three is the neater solution and also covers a number of the potential issues, however, it feels like quite a technical solution to what feels like should be a simple problem hence wondering if there was a better one.

I will log the duplication issue as a bug later as it seems we feel it should work even if it is a sub-optimal solution :wink: