I have the following implemented where I can create an envelope from a template id and redirect a user to the envelope to complete and sign it. I am trying to figure out how to redirect a user to the same already started but not yet completed envelope. How can I achieve this?
Here is the creation of the EnvelopeDefinition
:
private EnvelopeDefinition CreateEvelope(ApplicationUser user, UserFormRequestViewModel vm)
{
string recipientName = vm.FirstName.Trim() + " " + vm.LastName.Trim();
string recipientEmail = user.Email;
// template we want signed
string templateId = "e29f3966-2c3e-4c47-a997-278e937dc85c";
var envDef = new EnvelopeDefinition();
envDef.TemplateId = templateId;
envDef.EmailSubject = "Sample Form";
TemplateRole trole1 = new TemplateRole();
trole1.Email = recipientEmail;
trole1.Name = recipientName;
trole1.RoleName = "Taxpayer";
trole1.ClientUserId = user.Id;
trole1.Tabs = new Tabs
{
TextTabs = new List<Text> {
//prefill some fields
new Text { TabLabel = "SpouseName", Value = vm.SpouseName.ToString() }
}
};
List<TemplateRole> roleList = new List<TemplateRole>() { trole1 };
envDef.TemplateRoles = roleList;
envDef.Status = "sent";
return envDef;
}
and the sending of the envelope:
internal string Send(ApplicationUser user, UserFormRequestViewModel vm)
{
try
{
CheckToken();
EnvelopeDefinition envelope = this.CreateEvelope(user, vm);
EnvelopesApi envelopeApi = new EnvelopesApi(ApiClient.Configuration);
EnvelopeSummary results = envelopeApi.CreateEnvelope(AccountID, envelope);
string envelopeId = results.EnvelopeId;
var envelopeDetails = envelopeApi.GetEnvelope(AccountID, envelopeId);
RecipientViewRequest viewOptions = new RecipientViewRequest
{
ReturnUrl = "https://demo.taxdox.com/Home/UserFormRequest",
ClientUserId = user.Id,
AuthenticationMethod = "none",
UserName = vm.FirstName.Trim() + " " + vm.LastName.Trim(),
Email = user.Email
};
ViewUrl viewUrl = envelopeApi.CreateRecipientView(AccountID, envelopeId, viewOptions);
//calling method redirects user to this url
return viewUrl.Url;
}
catch(Exception ex)
{
throw;
}
}
the EnvelopeSummary
I receive from the CreateEnvelope
method contains an EnvelopeId
that I am guessing I can use to redirect a user back to the same envelope if they quit out before completing however I have not found a way to do this yet.
All you need to know is the envelopeId that you wish to use for this.
this code:
ViewUrl viewUrl = envelopeApi.CreateRecipientView(AccountID, envelopeId, viewOptions);
//calling method redirects user to this url
return viewUrl.Url;
Would let you view any envelope that you specify in the envelopeId parameter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.