2

I am trying to display a finish screen after a file upload which should be displayed only if the file upload was a success, so need to add a decision element.I tried using a text collection variable for the document Id in file upload and checking if it's not null in the decision element but it doesn't work

1
  • I can't do a screenshot on mobile as Salesforce blocks that,, nor can I open the flow elements on mobile, but I was able to do this using an assignment that sets the length of a variable, and evaluating that variable in the decision element. I'll look at the details when I'm at a desktop.
    – gorav
    Sep 20 '20 at 17:40
2

When I did this about 6 months ago, I manually mapped the contentDocumentIds to a collection variable. It ought to work without that, but I went the manual route, and I would like to believe that was for a good reason.

Then I used an assignment element to set a number variable equal to the size of the collection variable via the equals count operator.

The decision evaluates the number variable and routes to an error screen if no attachment was uploaded.

Not so elegant, but it works. Screenshots below

flow overview

overview

manual mapping (for file upload element in scrUploadFile)

manual mapping

assignment asstSetLength

assignment element

1
  • Thanks , this works
    – Sam
    Sep 23 '20 at 16:30
1

I did something similar to @gorav and found a way to do it a bit simpler.

  1. Don't need to manually assign variables on the upload component. Do still use the collection variable to store the Content Document IDs, which is always required.
  2. Create a number variable to hold the count. I set the default value to 0 (not sure if that matters or not). Use Assignment to set your number variable to EQUALS COUNT of [select the upload screen component > Content Document IDs].
  3. Decision element: If the count variable = 0, no documents were uploaded

Hope this helps anyone else who comes looking for an answer here, and thanks to @gorav for pointing out the need for the assignment element and count variable!

enter image description here

enter image description here

enter image description here

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.