How to Save Signature from Pen Control in Canvas App to Dynamics 365 text field

Follow Debajit’s Power Apps & Dynamics 365 Blog on WordPress.com

This content has been update with the introduction of new capabilities in Canvas Apps. Please follow this link for updated content.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

11 thoughts on “How to Save Signature from Pen Control in Canvas App to Dynamics 365 text field”

  1. Hi Debajit,
    Thanks for this wonderful trick. I got the string but when i load that base64 string with our dynamics 364 pen control, the image of signature is not loading correctly and it is just showing blank. Any idea? Even i tried with online base 64 to image converter but image is not showing correctly.
    Thanks

  2. My Sample output is as below. sorry for pasting it too long text but i dont have option to attached the output.
    data:image/png;base64,TFMxa05qUXdNamMxWVMwd01EZ3lMVFJtTlRVdE9USXdZaTFsTlRsaU5EUXlOemRtWW1FTkNrTnZiblJsYm5RdFJHbHpjRzl6YVhScGIyNDZJR1p2Y20wdFpHRjBZVHNnYm1GdFpUMGlabWxzWlNJN0lHWnBiR1Z1WVcxbFBTSm1hV3hsWHpaa1lXSTBZV0ZtTFRJeE0yTXROR0l6TWkwNE56TTFMVGxsTW1KalltSmlaRFJrTnk1d2JtY2lEUXBEYjI1MFpXNTBMVlI1Y0dVNklHbHRZV2RsTDNCdVp3MEtEUXFKVUU1SERRb2FDZ0FBQUExSlNFUlNBQUFCandBQUFUQUlCZ0FBQUU4Ry9VY0FBQWtiU1VSQlZIaWM3ZDI3cXlSWkhRZnczeDloYUdoa0lxSzVnaUFZaUtCaVlHQzJHSWlCSmdvN0prYXVHNGlDSWhxSUlMNFF4STBNQkhIQkIrajZRSFl4RUZkWFprZkIyWEZtMWxudVkvb2EzT2s3cDd0UFBVNVAzenFudWo0ZktKaTV4ZHorM1R2VjlldHZuYXB6SW1CYW40bUlWYkk5VTdjY0FPYmdJdGxXbFdzQllBWXV0amFwQTRCZXE1QTZBQ2l3M1Rpa0RnQjZuY2R1NDVBNkFPaTEzVGlrRGdCNjVTNVhYVlN0Q0lDbW5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V2RzYngxTkFBbWNTK083MXAvMTExVEYxRm5RUzZBbzNRczZVUEtBSmhRT2g1d1dybVdVamZEWFZNQTFjd3RmUmdBQjJqQUhOTEgyOEtsS1lEbXRKbytESUFETkN4TkgrZVZhNG1RTWdCbW8vWkoyZ0E0d0F6OVBIWlAybCs0aHRmNWZsdzJnNjVHWVFBY1lJYTZsbHY5WXVIMytWR01heEl1VFFFY2lhN2JZUSs5cldJK2E4QURNTkpwbENjSFRRS0FLK3RHTW1iVEpBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQTRxUDhEeG1NTERsaThsalFBQUFBQVNVVk9SSzVDWUlJTkNpMHRaRFkwTURJM05XRXRNREE0TWkwMFpqVTFMVGt5TUdJdFpUVTVZalEwTWpjM1ptSmhMUzBOQ2c9PQ==

    1. Hi Kartik
      I have updated my post. Please check for it. specifically changes are there while setting the content variable in flow and the Open API sample JSON for the input parameter “content”. Canvas apps seems to send this as double base64Encoded which is the issue now.

  3. If the objective is to save the Pen control image to Notes entity in CRM, the below solution will work.
    Firstly, save the pen image in JSON format while including the binary data
    Set(PenVar,JSON( Signature.Image,JSONFormat.IncludeBinaryData)); // Signature is the name of the Pen Control
    Next, strip the JSON data while leaving the 64-bit image
    Set(PenInput64Bit,Mid(PenVar,24,Len(PenVar)- 24));
    Save the note to the CRM notes entity
    Patch(Notes,Defaults(Notes),{subject:Title.Text,filename:”Signature.jpg”,isdocument:true,documentbody:PenInput64Bit});

Comments are closed.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading