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 III
Super User III

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 III
Super User III

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

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (69,293)