Label field format changes after sign
Thursday, May 11, 2023 at 07:53amFor this form, we are seeing an unusual behavior. Prior to signing, the values in a label field are appearing in a different format than after signature. The line breaks are not being recognized before signing.
See the attached images. Our preference is the after signing format.
This is generated via the Apex SDK.
Any thoughts on how to prevent this?
Reply to: Label field format changes after sign
Thursday, May 11, 2023 at 09:01amHi Peter,
It's very nice to hear from you!
May I know how you set the label field value and add the line breaks? (from my knowledge, I only knew that textarea field supports multiple lines text)
Back to the topic, there's a new feature Imprint Field newly introduced in release 11.51 which could be related to your question. Imprint fields will be presented in after signing format because it's stamped to the document once uploaded. If you are interested in this new feature, there will require some APEX SDK modelling changes to support that, which I can help you with. Let me know your thoughts.
Duo
Reply to: Label field format changes after sign
Friday, May 12, 2023 at 07:28amThank you Duo, Imprint Field looks like a great new feature. I would like to give it a try since we are using this pattern (stamping fields with data pre-flight) heavily but all fields are associated with the first signer.
For our specific issue, we are using Salesforce flow to pass in a "TextTemplate" / "Pain Text" field into the JSON.
The output looks like this:
"fieldValue" : "REG LINE 1\nREG LINE 2\nREG LINE 3\nREG LINE 4\nREG LINE 5\nREG LINE 6",
"fieldType" : "label",
"fieldName" : "Text Field 4"
By the way, this project has been very successful. I owe you many thanks for all the help you gave us during the implementation. We launched in late July with just a couple forms, have more than a dozen form templates available now, and we have seen 14,000 transactions sent. The feedback has been extremely positive. Thanks again.
Reply to: Label field format changes after sign
Friday, May 12, 2023 at 09:32amHi Peter,
Thank you! I am so glad to hear that and it is my pleasure to assist you with your project!
Thanks for sharing the label field value, I can reproduce the same if I created the transaction via RESTful JSON, while it doesn't show in multiple lines if I did so via designer UI, I will look closer into this.
For imprint field, it looks like this in JSON:
{
......
"documents": [
{
"imprintFields": [
{
"id": "imprint_field_id",
"subtype": "LABEL",
"left": 144.0,
"width": 165.0,
"height": 37.0,
"page": 0,
"fontSize": 12,
"top": 389.0,
"type": "INPUT",
"value": "John Smith",
"name": "imprint_field_name"
}
],
"approvals": [
{
......
}
],
"name": "Test Document"
}
],
"name": "Test Imprint Field",
"language": "en",
"status": "DRAFT"
}
The imprint fields should apply the same API schema as normal fields, hence you just need to extend the APEX sdk modelling at > class OneSpanAPIObjects > around line 279:
public class Document
{
......
public List<Field> imprintFields;
......
}
Below is an example in real practice:
OneSpanSDK sdk = new OneSpanSDK();
//Create package
OneSpanAPIObjects.Package_x pkg = new OneSpanAPIObjects.Package_x();
pkg.name = 'Test Postiion Extraction - ' + Datetime.now().format();
pkg.status = OneSpanAPIObjects.PackageStatus.SENT;
//Create Roles
String roleId1 = 'Signer1';
OneSpanAPIObjects.Role role1 = new OneSpanAPIObjects.Role();
role1.signers = sdk.createRolesSigner('FirstName', 'LastName', '[email protected]', 'CEO', 'ABC Bank');
role1.id = roleId1;
role1.name = roleId1;
pkg.roles = new List<OneSpanAPIObjects.Role>{role1}; //add role
//Prepare Documents Blob
String document1Name = 'Document1';
StaticResource sr = [SELECT Id, Body FROM StaticResource WHERE Name = 'test_position_extraction' LIMIT 1];
Map<String,Blob> documentBlobMap = new Map<String,Blob>();
documentBlobMap.put(document1Name, sr.Body);
//Create Document Metadata
OneSpanAPIObjects.Document document1 = new OneSpanAPIObjects.Document();
document1.name = document1Name;
document1.id = document1Name;
document1.extract = true; //document level extraction:true
OneSpanAPIObjects.Approval approval1 = new OneSpanAPIObjects.Approval();
approval1.role = roleId1;
approval1.name = 'Approval1';
//signature
OneSpanAPIObjects.Field field1 = new OneSpanAPIObjects.Field();
field1.extract = true;
field1.name = 'Signature1'; //matches the form field name in PDF
field1.type = 'SIGNATURE';
field1.subtype = 'FULLNAME';
//imprint field
OneSpanAPIObjects.Field field2 = new OneSpanAPIObjects.Field();
field2.type = 'INPUT';
field2.subtype = 'LABEL';
field2.page = 0;
field2.top = 100;
field2.left = 100;
field2.width = 200;
field2.height = 300;
field2.value= 'REG LINE 1\nREG LINE 2\nREG LINE 3\nREG LINE 4\nREG LINE 5\nREG LINE 6'; //display value
document1.imprintFields = new List<OneSpanAPIObjects.Field>{field2};
//Link field to approval, approval to document, document to package
approval1.fields = new List<OneSpanAPIObjects.Field>{field1};
document1.approvals = new List<OneSpanAPIObjects.Approval>{approval1};
pkg.documents = new List<OneSpanAPIObjects.Document>{document1};
//Send package One Step
String packageId = sdk.createPackage(pkg,documentBlobMap);
System.debug('PackageId: ' + packageId);
Let me know how this works for you.
Duo