Form designer: How to hide an attachment field according to the action name and if a file has been uploaded

Issue

We would like the file attachment field in an eForm to be hidden in subsequent tasks after initial upload task if no file has been uploaded for that field. If a file has been uploaded, then it should stay visible.

Is there a condition/attribute one could use? We would combine it with a task name condition (hidden if !task.name = "xxx" && ???).

Solution

In the field validation tab of the upload control, check hidden, then enter the code below:

this.CurrentWorkflowActionName !="INITIATES" && !REQUEST_ATTACHMENT.HasFile

Replace REQUEST_ATTACHMENT with the full ID of your upload field, and replace INITIATES with the action name where the file is uploaded.