# Remove upload attachement from attachement category

**URL:** <https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207>\
**Category:** User Experience\
**Tags:** user-experience, pega-platform, case-management\
**Created:** [March 23, 2023, 11:59am UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207 "2023-03-23T11:59:08Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AmiraF34](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/amiraf34/32/8347_2.png) [@AmiraF34](https://forums.pega.com/u/AmiraF34)\
**Post date:** [March 23, 2023, 11:59am UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/1 "2023-03-23T11:59:08Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![ArulDevan](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/aruldevan/32/23602_2.png) [@ArulDevan](https://forums.pega.com/u/ArulDevan)\
**Post date:** [March 23, 2023, 12:45pm UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/2 "2023-03-23T12:45:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AmiraF34](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/amiraf34/32/8347_2.png) [@AmiraF34](https://forums.pega.com/u/AmiraF34)\
**Post date:** [March 23, 2023, 1:22pm UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/3 "2023-03-23T13:22:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ArulDevan](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/aruldevan/32/23602_2.png) [@ArulDevan](https://forums.pega.com/u/ArulDevan)\
**Post date:** [March 24, 2023, 2:50am UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/4 "2023-03-24T02:50:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AmiraF34](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/amiraf34/32/8347_2.png) [@AmiraF34](https://forums.pega.com/u/AmiraF34)\
**Post date:** [March 27, 2023, 12:09pm UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/5 "2023-03-27T12:09:36Z")

</div>

@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

 ![Capture_0.PNG](https://pega1.discourse-cdn.com/pega/original/2X/0/0fa998a91583ae1c9980865815abc1b6f4725baf.png)

 ![Capture_0.PNG](https://pega1.discourse-cdn.com/pega/original/2X/0/0fa998a91583ae1c9980865815abc1b6f4725baf.png)

---

<div class="post-metadata">

**Author:** ![ArulDevan](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/aruldevan/32/23602_2.png) [@ArulDevan](https://forums.pega.com/u/ArulDevan)\
**Post date:** [March 27, 2023, 1:26pm UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/6 "2023-03-27T13:26:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AmiraF34](https://yyz2.discourse-cdn.com/pega/user_avatar/forums.pega.com/amiraf34/32/8347_2.png) [@AmiraF34](https://forums.pega.com/u/AmiraF34)\
**Post date:** [March 28, 2023, 9:50am UTC](https://forums.pega.com/t/remove-upload-attachement-from-attachement-category/4207/7 "2023-03-28T09:50:23Z")

</div>

@ArulDevan Thank you a lot for your help and explanations 🙂
