Digital Signature - Store as image and display

0
Hi, I am using the Mendix Digital Signature widget on a form that requires two signatures (Requestor and Approver). Once the 'Requestor' signs and confirms the form, the 'Approver' will see the form in a read-only page, and should see the 'Requestor' signature as an image so they cannot change the signature. (Since the widget has a 'reset signature' option) I understand that the digital signature is stored as a base64encoded unlimited string, and in order to save it it must be decoded using the Base64DecodeToFile Java Call from CommunityCommons.  I am using this Model Share from another forum post to try to make this work. (https://modelshare.mendix.com/models/f7e93184-fa93-41e9-81ab-47c7ec93f9e7/signature-store-signature-as-image) While replicating this model, I receive an error on the Base64DecodeToFile step that says: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.IllegalArgumentException: Source file is null     at ProcurementModule.ACT_SetDigitalSignatureURL (JavaAction : 'Base64DecodeToFile')   Can anyone guide me in the right direction to either fix the error I receive or a better way to solve the problem? Once the error is resolved and I am able to save the signature to the file object, how do I display this as an image within the Mendix App?   Thank You,   Jeff    
asked
4 answers
0

It sounds like the FileDocument input you're giving to the Java action is empty. I'm guessing the original model sharer had previously created a document elsewhere, because he's retrieving it over association.

In that case, can you create yourself a new object of an entity that extends System.FileDocument here or elsewhere? And actually, to address your second question, if you make that entity extend System.Image instead of System.FileDocument, you should be able to display it on a page using the native dynamic image viewer widget.

Good luck and let us know if you run into any issues along the way.

 

 

answered
0

Thank you Eric. I was able to use your suggestion of creating a new entity within the microflow and it no longer errors out. I can also see that the entity name is created successfully as the microflow is intending to do. 

 

My main entity is called "Request" and I have a 1-1 relationship with another entity called "SignatureImage". Can you tell me if the basic microflow below looks correct?

I assume once this is correct I just need to add the 'image viewer' and select the 'SignatureImage' entity over association of the 'Request'?

 

Snip of the Microflow:

 

answered
0

My model was creating the signature image properly, but it was not associating the SignatureImage to the Request. I have updated the model to return the NewSignature, and updated the association with the return value. This is now working properly.

 

Thank You,

 

Jeff

answered
0

My modeler will not let me use the Share model button...but hopefully this helps. let me know.

Check your security on the Signature object and make sure it is of System.Image generalization.

Create the signature object (required) prior to displaying the widget on your page:

 

Display the signature widget on a page with a way for the user to Accept signature:

Save the signature after the user has signed. (Accept button runs this MF...)


 

 

Then when I retrieve the Signature I just use an Image Viewer:

answered