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

Capture Photo in PowerApps with Camera Controll and Patch it in Dynamics "entityimage"

I want to capture a photo on a PowerApps Screen I followed below steps and it works perfectly.

However, in the Canvas App Editor it gives me an error 

Operation: On a Camara Click it will store the photo in the Dynamics Entity as primary image (Field Name entityimage, Display Name: PrimaryImage).

 

Code is as Below:

 

UpdateContext({lvarPic:cam_getWAB.Photo});

Patch(MyEnitty,Defaults(MyEntity),
{

Name:recordName,
PrimaryImage:lvarPic

});
Navigate(NextScreen);

 

After Pubishing it works absolutely as expteced but it still in the App Editor shows error and I cannot test it further in my Desktop.
Error is as below:

 

 

PatchError.jpgPatchError2.jpg

 

 

 



 

 

 Any Help/Comment will be appriciated.

8 REPLIES 8
PytByt
Post Prodigy
Post Prodigy

Hi @ArpG 

I think the image data type is not match, ive tried this formula before and it works:

Collect(Camcoll, {Media:Camera1.Photo}); 

And then patch it to the Data Entity like this:

ForAll(Camcoll, Patch('EntityMedia', Defaults('EntityMedia'),{ImageData: Media});

Of course, you can patch it directly to the Entity without the collection.

 

See if this help.

 

Regards,

pytbyt

ArpG
Frequent Visitor

Hi @PytByt  ,


Thanks for the reply.
In you solution you are putting the captured photo in a collection and then patching the image.
But while patching still you are passing the value of the item "Media", which is as good as storing the photo in a variable passing it in the Patch.

However, I have replicated the same way you did, but still have the same result.
New Code is as below, 

Collect(Camcoll,{Media: cam_getWAB.Photo});
ForAll(Camcoll,Patch(MyEnitty,Defaults(MyEntity),{Name:recordName,PrimaryImage:Media}));

 

But result is exactly as before.

Regards,

Arpan
 

Hi @ArpG 

You can always directly patch the cam_getWAB.Photo into your data entity.

 

Such as:

Patch(MyEntity,
    Defaults(MyEntity),
        {
          Name:recordName,
          PrimaryImage:cam_getWAB.Photo
        }
);

See if this helps.

 

Regards,

pytbyt

ArpG
Frequent Visitor

Hi @PytByt ,

 

I tried that way as well, but error always same.

I don't know why this field(PrimaryImage) expecting a Record and not a Image.

I would like to mention that I am see this error after 15th Jan,2020. Before That I have never experienced it.

 

 

Regards,

Arpan

hi @ArpG 

 

Could you change the data type of the column?

 

regards,

pytbyt

Hi @ArpG

Yes I agree with you and in fact this is a super easy function of patching image in either way. Noting wrong.

All my apps are working perfectly which made before mid of Jan 2020.

Thereafter, even using the same entity to Patch image into NEWLY created apps, the problem come and it is same as you. Entityimage is treated as Record.

I guess might be something PA team needs to look into possible bugs during your update.

I am stuck for weeks suddenly I become stupid in saving image...Maybe.

Please investigate.
Tq
ArpG
Frequent Visitor

Hi @PK_Hong ,

 

Exactly on 15th Jan, I have tested the App without any error on the browser.

I am experiencein the problem after that. and surprizingly, eventhough the browser shows the error but after publishing the app works perfectly all right.

 

Now Question is who is going to investigate it ?

 

KR,

Arpan

@ArpG 

Surprisingly it works after publishing?
I will test and hope it works.

BTW, microsoft staff has replied that using NewForm -> EditForm can SubmitForm to save image successfully and then i use Gallery to display. Just Remove is an issue.

At lease EditForm can do it and I have also prompted for investigation.

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Image-for-CDS-was-treated-as-RECORD-and-stop...

 

Please have a look in this link for a temporary counter action.

At least I don;t disappoint customer who is awaiting my Check-In-Check-Out apps for capturing GPS (excellent to show in map) and Picture (during check in...) though after enlarged, quality is still... .:(.

 

have a nice day

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,045)