cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Capture Image and Save as Attachment

Hi @RezaDorrani 

 

I am having an issue trying to send that attachment once it gets created into the Datacard.

 

When I click on the image it creates a link for the image in the attachments data card. The only issue with this is when I try to submit, it gives me an error saying, "entry is required or has an invalid value. please correct and try again." 

 

It won't submit the attachment of the camera control image, but if I click on attach a file, it goes straight to a folder to select a file and that file will allow me to submit. The issue seems like it has to do with the collection.

 

Would you be able to help me with this one more thing? 

(Attachment shows the error)

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Capture Image and Save as Attachment

Hi @Ajilakes ,

Do you want to upload the picture captured via Camera control into the Attachments control, and then submit the form data?

 

If you want to upload the picture captured via Camera control into the Attachments control, and then submit the form data, I afraid that there is no way to achieve your needs in PowerApps currently. In addition, the Patch fucntion in PowerApps could not also achieve your needs.

 

As an alternative solution, I think the combination of PowerApps and MS Flow could achieve your needs (fire a flow from your app, and pass the captured camera picture data). Within the Edit form of your app, your need to disable the "Attachments" field data card firstly.

I have maded a test on my side, please take a try with the following workaround:

Flow's configuration as below:8.JPG

 

App's configuration as below:6.JPG

 

7.JPG

 

9.JPG

Set the OnSelect proeprty of the Camera control to following formula:

ClearCollect(ImageData, {Name: "Camera1.jpg", Content: Camera1.Photo})

Set the OnSuccess property of the Edit form (Edit form1) to following:

CaptureCameraImagetoSPList.Run(JSON(ImageData, JSONFormat.IncludeBinaryData), EditForm1.LastSubmit.ID);   /* <-- Within 'FlowName'.Run() formula, specify values for the two arguments specified in your flow */
Back()

More details about firing a flow from an app, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

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.

View solution in original post

15 REPLIES 15
Highlighted
Dual Super User II
Dual Super User II

Re: Capture Image and Save as Attachment

Hi @Ajilakes 

 

I will test this use case

 

Highlighted
Dual Super User II
Dual Super User II

Re: Capture Image and Save as Attachment

@Ajilakes 

 

Got this to work using Patch command after submit form (that is the only way to achieve it) or use MS Flow

The Patch commnad scenario is complicated and I would have to do a video blog on it to explain the use case

I will plan to do it sometime mid next week 

 

 

Highlighted
Advocate II
Advocate II

Re: Capture Image and Save as Attachment

Thanks Reza,

 

I will wait for the video next week to fix this issue with my powerapps. 

Highlighted
Dual Super User II
Dual Super User II

Re: Capture Image and Save as Attachment

@Ajilakes 

 

FYI - It is a hack 🙂

Highlighted
Community Support
Community Support

Re: Capture Image and Save as Attachment

Hi @Ajilakes ,

Do you want to upload the picture captured via Camera control into the Attachments control, and then submit the form data?

 

If you want to upload the picture captured via Camera control into the Attachments control, and then submit the form data, I afraid that there is no way to achieve your needs in PowerApps currently. In addition, the Patch fucntion in PowerApps could not also achieve your needs.

 

As an alternative solution, I think the combination of PowerApps and MS Flow could achieve your needs (fire a flow from your app, and pass the captured camera picture data). Within the Edit form of your app, your need to disable the "Attachments" field data card firstly.

I have maded a test on my side, please take a try with the following workaround:

Flow's configuration as below:8.JPG

 

App's configuration as below:6.JPG

 

7.JPG

 

9.JPG

Set the OnSelect proeprty of the Camera control to following formula:

ClearCollect(ImageData, {Name: "Camera1.jpg", Content: Camera1.Photo})

Set the OnSuccess property of the Edit form (Edit form1) to following:

CaptureCameraImagetoSPList.Run(JSON(ImageData, JSONFormat.IncludeBinaryData), EditForm1.LastSubmit.ID);   /* <-- Within 'FlowName'.Run() formula, specify values for the two arguments specified in your flow */
Back()

More details about firing a flow from an app, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/using-logic-flows

https://www.youtube.com/watch?v=1wl9AtxWdkg

 

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.

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Capture Image and Save as Attachment

All I can say @v-xida-msft , 

 

You are a savior lol!! I needed that exact example and it helped me get the picture submitted with the form at the same time. Thanks for all the help, greatly appreciate it!!!

 

Best,

Alexander Lagos

Highlighted
Post Patron
Post Patron

Re: Capture Image and Save as Attachment

Hi @v-xida-msft , @Ajilakes 

I am having issues setting up the FLOW. (Can't imagine the issues I will come across when adding this to the PA...)

I followed your example but when I get to the Add Attachment step, the File content Expression is not valid.   You didn't highlight the File Name so I guessed 🙂 .  I used test.jpg, but the file content still was invalid.

 

I have many requests for PowerAPPs that will allow users to take images and attach them to the list item.  Too bad we can't just send the image to the attachment card 😞

 

FLOW_Attach.jpg

 

 

Highlighted
Post Patron
Post Patron

Re: Capture Image and Save as Attachment

Hi @v-xida-msft , @Ajilakes ,

One more issue I am having is when I am back in PA, on success the run() expects 3 arguments not 2

FLOW_Attach_PAError.jpg

 

Thanks for all your help!!

Joe

Highlighted
New Member

Re: Capture Image and Save as Attachment

@v-xida-msft @RezaDorrani  - I have tried the above example, however in PA I am getting an error message when I try to add the flow to  OnSuccess  the error is: invocation of unknown or unsupported function.  Any Ideas?

 

dayn_0-1602767950957.png

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (6,292)