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

How to create button which adds attachment?

Hello,

 

I have simple idea behind this.

I want to recreate same function which happens whenever you press "Add attachment", as a button.

Is this possible?

 

lukascaplikas_1-1600237206538.png

Thank you.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Hi @lukascaplikas :

  Do you want to use which camera button to add attachments to the attachments control?

  In theory, this is impossible to achieve. Because the function of Add Attachments is integrated internally, we can not call it directly.I think the only way at the moment is to add one more transparent attachment control over the button to achieve similar functions.Like this:

45.gif

I'v made a test for your reference:

1\Add an edit form

DataSource

List1 /*List1 is my data source*/

Item

First(List1)

2\Copy the attachments control (DataCardValue5) in the from and place its copy(DataCardValue5_1) outside of the from and on the upper layer of the "camera" button

2.JPG

 3\Set DataCardValue5_1's

Color

RGBA(0, 0, 0, 0)

BorderColor

RGBA(0,0,0,0)

Fill

RGBA(255, 255, 255, 0)

In a word, it is to turn it into a transparent color

OnAddFile

Collect(Mycollection,Self.Attachments); /*Mycollection is my custom collection*/
Reset(DataCardValue5_1)

Items(Delete its Items)


 4\Set DataCardValue5's

Items

Filter(Ungroup(Table({Value:Parent.Default},{Value:Mycollection}),"Value"),!IsBlank(Value))

The purpose of this operation is to combine the original Items in the control and the items collected in the copy into a table.

Best Regards,

Bof

View solution in original post

2 REPLIES 2
Highlighted
Resolver II
Resolver II

Hey @lukascaplikas 
The attachments control is slightly different than other controls but you can also interact with it.
Attachments control have:

365CornerDawid_0-1600237938938.png

 

Following properties when you will select it.
Basically you can define what will happen when User is adding, removing or canceling removal of the files.

Hope this help if this is resolving your problem please remember to select the answer as solution so other community Users can find answer quicker^^
Regards
Dawid

 

Highlighted
Community Support
Community Support

Hi @lukascaplikas :

  Do you want to use which camera button to add attachments to the attachments control?

  In theory, this is impossible to achieve. Because the function of Add Attachments is integrated internally, we can not call it directly.I think the only way at the moment is to add one more transparent attachment control over the button to achieve similar functions.Like this:

45.gif

I'v made a test for your reference:

1\Add an edit form

DataSource

List1 /*List1 is my data source*/

Item

First(List1)

2\Copy the attachments control (DataCardValue5) in the from and place its copy(DataCardValue5_1) outside of the from and on the upper layer of the "camera" button

2.JPG

 3\Set DataCardValue5_1's

Color

RGBA(0, 0, 0, 0)

BorderColor

RGBA(0,0,0,0)

Fill

RGBA(255, 255, 255, 0)

In a word, it is to turn it into a transparent color

OnAddFile

Collect(Mycollection,Self.Attachments); /*Mycollection is my custom collection*/
Reset(DataCardValue5_1)

Items(Delete its Items)


 4\Set DataCardValue5's

Items

Filter(Ungroup(Table({Value:Parent.Default},{Value:Mycollection}),"Value"),!IsBlank(Value))

The purpose of this operation is to combine the original Items in the control and the items collected in the copy into a table.

Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,378)