cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Post Prodigy
Post Prodigy

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

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

Highlighted
Frequent Visitor

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

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
 

Highlighted
Post Prodigy
Post Prodigy

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

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

Highlighted
Frequent Visitor

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

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

Highlighted
Post Prodigy
Post Prodigy

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

hi @ArpG 

 

Could you change the data type of the column?

 

regards,

pytbyt

Highlighted
Resolver II
Resolver II

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

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
Highlighted
Frequent Visitor

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

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

Highlighted
Resolver II
Resolver II

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

@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
Ignite

Microsoft Ignite

This will be a conference that you do not want to miss!

secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

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