Hi Expertise,
Recently i am facing an issue while saving the image as attachment in CRM captured by camera control from canvas app .
I saves the imag as jpeg format to collection from camera control. As camera control gives the URL as base64 string of captured image with the prefix “data:image/jpeg;base64,”. so, i replaced initial string with ""(blank) and saved into the CRM . the record has been saved but while opening the attachment from CRM ,it gives below error
After digging more, i found that the base 64 string of saved image from the camera control was like "/png" as shown below and not the "/jpeg" and i was replaing the initial string by considering it as "/jpeg",
In CRM these attachments are stored as jpg type as below:
I followed the same steps earlier(before recent update) also but at that time i didn't face such issue.
can anyone of you let me know why this behaviour of mismatching of base64 string is happening after the recent updated of powerapps?
thanks in advance.
Solved! Go to Solution.
Hi @Dexx3336,
Just from the error message, it told that the base64 string contains invalid characters.
"The input is not a valid base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "
Have you tried to save the image directly without doing any modification?
The image saved from the camera control could be saved directly to the image field of the CRM entity.
Besides, take a look at the following blog for how to "link" Image in CDS into Dynamics 365:
PowerApps - Working with Images Part 1
Regards,
Michael
Hi @Dexx3336,
Just from the error message, it told that the base64 string contains invalid characters.
"The input is not a valid base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. "
Have you tried to save the image directly without doing any modification?
The image saved from the camera control could be saved directly to the image field of the CRM entity.
Besides, take a look at the following blog for how to "link" Image in CDS into Dynamics 365:
PowerApps - Working with Images Part 1
Regards,
Michael
Thanks, @v-micsh-msft for a response.
I can not save the image captured from camera control directly to the CRM as it appends some string at its prefix like belowMy requirement is to store the captured images as attachments in notes entity against OOB/custom entities so I have to replace unwanted string to store in notes.
Earlier i was getting "data:image/jpeg;base64," and now i am getting "data:image/png;base64,"unwanted string.
So I used below code to replace the unwanted string.
If(StartsWith(First(Image).fileBody,”data:image”),Replace(First(Image).fileBody,1, Len(Left(First(Image).fileBody,Find(“,”,First(Image).fileBody))),””),First(Image).fileBody)});
The conversion of unwanted string is resolved using above code. But now i stuck at another issue: Not able to create the attachment regarding any entity
User | Count |
---|---|
141 | |
140 | |
76 | |
73 | |
71 |
User | Count |
---|---|
230 | |
171 | |
74 | |
69 | |
60 |