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
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?