cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ed_C
Helper I
Helper I

How to only allow user add attachment but can't remove the attachment

Hi all

 

I as subject, I want to let user can't remove what they attached.
Because, when I get all the version of that record, if I remove the attachment there will show 2 version with same comments.(like the pic below) 
And, I don't what user remove the attachment because the attachment is the issue evidence.

Ed_C_0-1610961997728.png

 

3 ACCEPTED SOLUTIONS

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Ed_C ,

The attachment control is either Edit or View mode (or New), so if a user has permission to add an attachment, they can also delete another one. You could consider making it View mode based on date or number of attachments, but that is all you could do.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

View solution in original post

could you tell me more about how to control based on date?
I think a way to deal with that. I used a button cover the remove button, and what way you want to show just depend on style. Hope that it can help others when facing this problem.

Ed_C_0-1611022857992.png

 

View solution in original post

Hi @Ed_C ,

Just a concept - firstly create a Date field in your List (I will call it AttachDate here).

On the OnAddFile action in the Attachment

Patch(
   YourSPList,
   {ID: ThisItem.ID},
   {AttachDate: Today()}
)

If you wanted to only allow changes on the current day, put on the DisplayMode of the Attachment Control

If(
   Value(ThisItem.AttachDate) > 0 && !IsToday(ThisItem.AttachDate),
   DisplayMode.View,
   Parent.DisplayMode
)

If you want to give them (say) another day, put this

If(
   Value(ThisItem.AttachDate) > 0 && 
   DateDiff(
      ThisItem.AttachDate,
      Today(),
      Days
   ) > 1,
   DisplayMode.View,
   Parent.DisplayMode
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Ed_C ,

The attachment control is either Edit or View mode (or New), so if a user has permission to add an attachment, they can also delete another one. You could consider making it View mode based on date or number of attachments, but that is all you could do.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

could you tell me more about how to control based on date?
I think a way to deal with that. I used a button cover the remove button, and what way you want to show just depend on style. Hope that it can help others when facing this problem.

Ed_C_0-1611022857992.png

 

Hi @Ed_C ,

Just a concept - firstly create a Date field in your List (I will call it AttachDate here).

On the OnAddFile action in the Attachment

Patch(
   YourSPList,
   {ID: ThisItem.ID},
   {AttachDate: Today()}
)

If you wanted to only allow changes on the current day, put on the DisplayMode of the Attachment Control

If(
   Value(ThisItem.AttachDate) > 0 && !IsToday(ThisItem.AttachDate),
   DisplayMode.View,
   Parent.DisplayMode
)

If you want to give them (say) another day, put this

If(
   Value(ThisItem.AttachDate) > 0 && 
   DateDiff(
      ThisItem.AttachDate,
      Today(),
      Days
   ) > 1,
   DisplayMode.View,
   Parent.DisplayMode
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (4,123)