public override async Task Run() { var userDefinedFields = Storage.FirstCrateOrDefault <KeyValueListCM>(x => x.Label == UserFieldsAndRolesCrateLabel); if (userDefinedFields == null) { throw new ActivityExecutionException("Activity storage doesn't contain info about DocuSign envelope properties. This may indicate that activity was not properly configured. Try to reconfigure this activity"); } var allFields = userDefinedFields.Content.Values; var roleValues = ActivityUI.RolesFields.Select(x => new { x.Name, Value = x.TextValue }).ToDictionary(x => x.Name, x => x.Value); var fieldValues = ActivityUI.CheckBoxFields.Select(x => new { x.Name, Value = x.Selected.ToString().ToLower() }) .Concat(ActivityUI.DropDownListFields.Select(x => new { x.Name, Value = x.selectedKey })) .Concat(ActivityUI.RadioButtonGroupFields.Select(x => new { x.Name, x.Radios.FirstOrDefault(y => y.Selected)?.Value })) .Concat(ActivityUI.TextFields.Select(x => new { x.Name, Value = x.TextValue })) .ToDictionary(x => x.Name, x => x.Value); var docuSignConfiguration = DocuSignManager.SetUp(AuthorizationToken); var roleFields = allFields.Where(x => x.Tags.Contains(DocuSignConstants.DocuSignSignerTag, StringComparison.InvariantCultureIgnoreCase)).ToList(); foreach (var roleField in roleFields) { roleField.Value = roleValues[roleField.Key]; } var userFields = allFields.Where(x => x.Tags.Contains(DocuSignConstants.DocuSignTabTag)).ToList(); foreach (var userField in userFields) { userField.Value = fieldValues[userField.Key]; } DocuSignManager.SendAnEnvelopeFromTemplate(docuSignConfiguration, roleFields, userFields, SelectedTemplateId); }
private void SendDocuSignTestEnvelope(DocuSignManager docuSignManager, DocuSignApiConfiguration loginInfo, AuthorizationTokenDO authTokenDO) { var rolesList = new List <KeyValueDTO>() { new KeyValueDTO() { Tags = "recipientId:1", Key = "role name", Value = ToEmail }, new KeyValueDTO() { Tags = "recipientId:1", Key = "role email", Value = ToEmail } }; var fieldsList = new List <KeyValueDTO>() { new KeyValueDTO() { Tags = "recipientId:1", Key = "companyTabs", Value = "test" }, new KeyValueDTO() { Tags = "recipientId:1", Key = "textTabs", Value = "test" }, new KeyValueDTO() { Tags = "recipientId:1", Key = "noteTabs", Value = "test" }, new KeyValueDTO() { Tags = "recipientId:1", Key = "checkboxTabs", Value = "Radio 1" }, new KeyValueDTO() { Tags = "recipientId:1", Key = "listTabs", Value = "1" } }; docuSignManager.SendAnEnvelopeFromTemplate( loginInfo, rolesList, fieldsList, templateId ); }
protected virtual void SendAnEnvelope(DocuSignApiConfiguration loginInfo, List <KeyValueDTO> rolesList, List <KeyValueDTO> fieldList, string curTemplateId) { try { DocuSignManager.SendAnEnvelopeFromTemplate(loginInfo, rolesList, fieldList, curTemplateId); } catch (Exception ex) { RaiseError($"Couldn't send an envelope. {ex}"); return; } Success(); }
protected override void SendAnEnvelope(DocuSignApiConfiguration loginInfo, List <KeyValueDTO> rolesList, List <KeyValueDTO> fieldList, string curTemplateId) { try { var documentSelector = GetControl <CrateChooser>("document_selector"); var fileCrate = documentSelector.GetValue(Payload); if (fileCrate == null) { RaiseError($"New document file wasn't found"); return; } var file_manifest = fileCrate.Get <StandardFileDescriptionCM>(); DocuSignManager.SendAnEnvelopeFromTemplate(loginInfo, rolesList, fieldList, curTemplateId, file_manifest); } catch (Exception ex) { RaiseError($"Couldn't send an envelope. {ex}"); } Success(); }