private async Task <Tuple <ActivityDTO, Guid> > AuthorizeAndConfigureDocuSignActivity(ActivityDTO docuSignActivity) { var crateStorage = Crate.GetStorage(docuSignActivity); var authenticationRequired = crateStorage.CratesOfType <StandardAuthenticationCM>().Any(); var tokenId = Guid.Empty; if (authenticationRequired) { var terminalSummaryDTO = new TerminalSummaryDTO { Name = docuSignActivity.ActivityTemplate.TerminalName, Version = docuSignActivity.ActivityTemplate.TerminalVersion }; // Authenticate with DocuSign tokenId = await _docuSignTestTools.AuthenticateDocuSignAndAssociateTokenWithAction(docuSignActivity.Id, GetDocuSignCredentials(), terminalSummaryDTO); docuSignActivity = await Configure(docuSignActivity); } docuSignActivity.UpdateControls <Send_DocuSign_Envelope_v2.ActivityUi>(x => x.TemplateSelector.SelectByKey("SendEnvelopeTestTemplate")); //This configuration call will generate text source fields for selected template properties docuSignActivity = await Configure(docuSignActivity); docuSignActivity.UpdateControls <Send_DocuSign_Envelope_v2.ActivityUi>(x => { var roleEmailControl = x.RolesFields.First(y => y.Name == "TestSigner role email"); roleEmailControl.ValueSource = TextSource.UpstreamValueSrouce; roleEmailControl.selectedKey = "SuppliedEmail"; roleEmailControl.Value = "SuppliedEmail"; var roleNameControl = x.RolesFields.First(y => y.Name == "TestSigner role name"); roleNameControl.ValueSource = TextSource.UpstreamValueSrouce; roleNameControl.selectedKey = "SuppliedName"; roleNameControl.Value = "SuppliedName"; }); return(new Tuple <ActivityDTO, Guid>(await Save(docuSignActivity), tokenId)); }