Remove upload attachement from attachement category

Hello,

I am using a radio button to choose yes or no:

I have a request that:

if No: I need to upload a front and back of a file (2 files) ==> 2 files will be sent
if Yes: I need to upload only one file (only front) ==> only 1 will be sent

So as you can understand, I have 2 attachement categories: frontX and backX:

  • the frontX will be used in both yes or no cases; if yes I will upload a file in frontX and if no I will upload another one.
  • the backX will be used only in case no; if I click on yes, it should be reset (to not submit it)

All in all, whenever I click on yes or no, I need to remove what I uploaded in frontX and backX.

my question: how to remove the attachement uploaded when I click on yes or no, So I will not confuse the needed attachement that will be sent.

Thanks a lot in advance for your help!

Hi @AmiraF34: Hope you are using traditional UI. In such case, can you please check OOTB activity “DeleteAttachment” whether it can help you? You may need to pass pzinskey of Link and attachment class.

Thanks.

@ArulDevan Thanks for your reply.

I need just to delete the attachement relatad to one (the associated) attachment category.

This could not impact all the attachements in the case?

Hi @AmiraF34: The parameter passed to “DeleteAttachment” will be keys for “Link-Attachment” and “Data-WorkAttach-File” specific to the file. So it will do the deletion based on the parameter passed.

Please give a try on this for your scenario and let us know if you are facing any issues.

Please see the History tab of the rule for more details on how the parameters to be used.

Thanks

@ArulDevan In the attached screenshoot of the setup of Yes/No radio button, could you tell me please where I can give the specific attachement category to the file to be deleted ? I cannot figure out what I should give as parameters to relate the file category which will be deleted.

Thanks in advance

Hi @AmiraF34: The activity mentioned will delete based on pzinskey of Link and file. In your case if you have the values available in a page, then you can use them. If not, you may need to create a wrapper activity which does following

  1. Specify the parameters required for D_AttachmentList
  2. Loop D_AttachmentList to identify which attachment to be deleted and get the necessary parameters (key for LINK-ATTACHMENT and DATA-WORKATTACH-FILE)
  3. Call delete attachment outside the loop using the parameters gathered / Call pyDeleteAttachment within the context of the loop

Please let me know if this helps.

Thanks.

@ArulDevan Thank you a lot for your help and explanations :slight_smile: