PowerApps Pen Input – Have issues? Problem solved! (Sharepoint and CDS)

PowerApp “Pen input” control is different, like way more different than fx. Camera control. For the untrained eye that tries to extract its image, it seems that you only get access to a local blob storage URL (appres://blobmanager/). A ton of blogposts has more or less Complex descriptions on how to partly solve the extraction of the image… and there are even multiple replies and comments that say it cannot be done. This has most properly been true back in time…  but it is not valid any longer.

Here is a sample list of people making historical, more or less complicated solutions to extract the image.

  1. Pen Input as an attachment using Outlook connection (https://powerusers.microsoft.com/t5/Creating-Apps/PowerApps-Digital-Signature-to-Sharepoint-List/m-p/153702/highlight/true#M4252)
  2. Pen input to Microsoft Flow through a Custom connector based on the OpenAPI https://powerusers.microsoft.com/t5/General-Discussion/Pen-input-save-image-to-SharePoint/m-p/82215/highlight/true#M31819)
  3. Pen Input saved using Azure Blog Store: https://poszytek.eu/en/microsoft-en/office-365-en/flow-en/powerapps-hand-written-signature/

The new easy and multi-purpose solution

An easy and multi-purpose solution is found thanks to Shane Young, utilizing the addition of a PowerApps Json functionality added on 02/05/2019.

The Short description on how to make this work is to save the pen input image in a JSON format asking the JSON function to include Binary Data:

Set( PenVar, JSON( PenInput1.Image,JSONFormat.IncludeBinaryData ) );

Then strip the save JSON from the JSON format to only leave the 64 Bit encoded image.

Set( PenInput64Bit, Mid(PenVar, 24,Len(PenVar) - 24 ) );

Then post the raw image data to a Microsoft Flow function:

Sign_to_Sharepoint.Run(PenInput64Bit)

In Microsoft Flow then add the pen input image as an Email Attachment,  Onedrive file, Sharepoint file, etc. by using base64ToBinary functionality to convert it into the needed Binary format:

base64ToBinary(triggerBody()['PenInput64Bit'])

and that is it….see Shane Young demo how to save pen input to Onedrive, Sharepoint and use it in an Email and to include the pen input in a PDF.

Save Pen Input to CDS as Entity Image

If you have tried to save the Pen Input to an entity image in CDS you do not need any of the above conversion; just add the PenInput. Image directly to the Entity image attribute, and off you go. But at first, glance does not seem to work as when viewed in a Model-Driven app the image is all black. What happens is that the pen input as default has a transparent fill color, which is not supported by CDS entity images. To make it work, set Pen input fill color to white or another color of your choice.

Screenshot (76).png

That is it.. you now do not have any excuses for not using the PowerApp pen input for all your signature needs.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.