Replacing Notary workflow
Monday, July 12, 2021 at 03:53pmGuys,
I know you guys have been improving things for the new signing experience and I wanted to circle around to see if this workflow has been improved.
When we want to change notaries for a package do this workflow.
1. Find and delete all documents that have a notary endorsement
2. Re upload the notary documents with the new notary id
3. Update package information with new notary id
Has this process changed at all since we started way back when? Do you guys have an update feature where we can update the notary without having to delete the documents and endorsements from the package first?
Reply to: Replacing Notary workflow
Tuesday, July 13, 2021 at 09:39amHi Ryan,
From my understanding, the notary fields are the main concern why you have to remove signer then add instead of simply update the notary information - different notary users could have defined different notary fields.
However given your current flow, instead of deleting all documents containing notary's signatures, you might also want to give this flow an attempt:
(1) step1 get all signatures belonging to the notary
(2) step2 remove existing notary
(3) step3 add a new notary signer
(4) step4 migrate all signatures to the new notary
(5) specify new notary ID
Below code snippet is a sample I created for you. Rather than re-uploading documents, this solution might cost less time if you have large sized documents.
private PackageId createPackageOneStep = new PackageId("package_id");
private String notaryRoleId = "notary";
private String notaryEmail = "existing_notary_email";
private string updatedNotaryEmail = "updated_notary_email";
//change notary
//step1 get all signatures belonging to the notary
DocumentPackage originalPkg= eslClient.GetPackage(createPackageOneStep);
Dictionary<string,Signature> notaryDic = new Dictionary<string, Signature>();
foreach (var doc in originalPkg.Documents) {
foreach (var sig in doc.Signatures){
if (sig.SignerEmail == notaryEmail) {
sig.GetType().GetProperty("SignerEmail").SetValue(sig, updatedNotaryEmail, null);
notaryDic.Add(doc.Id,sig);
}
}
}
//step2 remove signer
eslClient.PackageService.RemoveSigner(createPackageOneStep, notaryRoleId);
//step3 add new notary signer
Signer newNotary = SignerBuilder.NewSignerWithEmail(updatedNotaryEmail)
.WithFirstName("new Duo")
.WithLastName("new Liang")
.WithCustomId(notaryRoleId)
.Build();
eslClient.PackageService.AddSigner(createPackageOneStep, newNotary);
//step4 add signatures
DocumentPackage updatedPkg = eslClient.GetPackage(createPackageOneStep);
foreach (KeyValuePair<string, Signature> entry in notaryDic){
eslClient.ApprovalService.AddApproval(updatedPkg, entry.Key, entry.Value);
}
//step5 specify notary ID
setNotaryRoleId(createPackageOneStep.Id, notaryRoleId);
private void setNotaryRoleId(String packageId, String notaryId) {
HttpClient httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", API_KEY);
httpClient.DefaultRequestHeaders.Add("Accept", "application/json");
string updatePackageString = "{\"notaryRoleId\" : \"" + notaryId + "\"}";
StringContent jsonUpdatePackageContent = new StringContent(updatePackageString, Encoding.UTF8, "application/json");
var response = httpClient.PutAsync(new Uri(API_URL) + "/packages/" + packageId, jsonUpdatePackageContent).Result;
if (!response.IsSuccessStatusCode)
{
throw new Exception(response.Content.ReadAsStringAsync().Result);
}
}
Duo