Help with Extracting Signature Name for email message body.
Hi All,
I am trying to extract the name of the last person to sign a form, to then use that name to include in an email message body.
Years ago I had it working comparing 3 possible signatures on my form. I later changed it to only 2 signatures but I can no longer get it to extract the name. I understand that it might not work 100% of the time depending on the time zone of the signing user.
My logic is : compare the timestamps to find the most recent - hoping that the most recent should be the person that hit the "send" button after signing the form.
So grab that name and drop it in the email message body.
My code... (and it might not be the most efficient - I am not so good at programming.
This code is in the Send button of the form under Mouse Up.
var sign1 = this.getField("Signature1");
var sign2 = this.getField("Signature2");
// get signature timestamps & names
var sigInfo1 = sign1.signatureInfo();
var sigInfo2 = sign2.signatureInfo();
var dt1 = sigInfo1.date;
var dt2 = sigInfo2.date;
var finalName = "";
var position = 0;
if (dt1 < dt2){
finalName = sigInfo2.name;
}
else{
finalName = sigInfo1.name;
}
//extract just the name which should be before
//the < of the email address in a self-issued signature in Adobe
position = finalName.indexOf("<");
if (position >= 0){
finalName = finalName.substring(0,position);
}
else{
finalName = "...";
}
cMessBody = cMessBody + "\u000D \u000DRegards, \u000D" + finalName;
Currently my code always ends-up with the finalName being "..."
Thanks,
Dan
