cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Make the attachment 1 time only

Hi all,

 

when using attachment, how to limit the control to only can add 1 time ?

 

image.png

 

So if like above, when I already attached ans has 1 file, the "attach file" is disable, or better hide it.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Champion
Community Champion

Re: Make the attachment 1 time only

Thanks @DevendraSingh - that function also works, but I was trying to disable it.

Hi @TZ ,

Try this then on the Visible property of the control

CountRows(YourAttachmentControlName.Attachments)=0

As soon as something attaches, it will disappear though and will still need to be saved.

 

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

6 REPLIES 6
Highlighted
Community Champion
Community Champion

Re: Make the attachment 1 time only

Hi @TZ ,
This will disable the control as soon as one item is added to it - on the DisplayMode of the control.

If(
    CountRows(YourAttachmentControlName.Attachments) > 0,
    DisplayMode.View,
    DisplayMode.Edit
)

 

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.

Highlighted
Frequent Visitor

Re: Make the attachment 1 time only

Hi WarrenBelz,

 

Wow, thanks, it works. The "attach file: did hide. Only it will show the attachment filename, is it ? 

like this :

image.png

Just a small favour, it is ok if cannot actually, but can that filename also hide or disabled ? because as I tried to click, then it will download the file.

 

Many thanks for your help.

 

 

Highlighted
Resolver I
Resolver I

Re: Make the attachment 1 time only

Hi,

You can set the Max attachments property of attachment control to 1. It will not allow you to upload more than one attachment. 

Please click Accept as Solution if my post helped you solve your issue.

 

Thanks & Regards,

Devendra Singh

 

Highlighted
Community Champion
Community Champion

Re: Make the attachment 1 time only

Thanks @DevendraSingh - that function also works, but I was trying to disable it.

Hi @TZ ,

Try this then on the Visible property of the control

CountRows(YourAttachmentControlName.Attachments)=0

As soon as something attaches, it will disappear though and will still need to be saved.

 

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

Highlighted
Community Support
Community Support

Re: Make the attachment 1 time only

Hi @TZ ,

Do you want to disable the Attachments control when you have attached files for this record already?

 

Based on the needs that you mentioned, I have made a test on my side, please consider take a try with the following workaround:

5.JPG

Set the DisplayMode property of the Attachments control under the Attachments field data card to following:

If(
    CountRows(ThisItem.Attachments) > 0, 
    DisplayMode.Disabled,       // Type 'Disabled' here rather than 'View'
    DisplayMode.Edit
)

then the Attachments control would be disabled if you have attached files to this record.

 

In addition, within above If function, please use ThisItem.Attachments formula to reference the Attachments property of current record rather than 

YourAttachmentControlName.Attachments

if you use above YourAttachmentControlName.Attachments formula in your If function, you could only attach single one file rather than multiple files. If you are going to attach files for a new record, when you attach a file for this new record, the Attachments control would be disabled or hidden, you could not attach another file any more.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Community Champion
Community Champion

Re: Make the attachment 1 time only

Thank you @v-xida-msft ,

That will work also - just trying to give @TZ some options.

 

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (11,029)