cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ajilakes
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
v-xida-msft
Community Support
Community Support

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

16 REPLIES 16
RezaDorrani
Dual Super User II
Dual Super User II

Hi @Ajilakes 

 

I will test this use case

 

@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 

 

 

Thanks Reza,

 

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

@Ajilakes 

 

FYI - It is a hack 🙂

v-xida-msft
Community Support
Community Support

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.

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

joef
Continued Contributor
Continued Contributor

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

 

 

joef
Continued Contributor
Continued Contributor

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

@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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,715)