Exemple #1
0
        public override async Task FollowUp()
        {
            var actionUi = new ActivityUi();

            actionUi.ClonePropertiesFrom(ConfigurationControls);

            //don't add child actions until a selection is made
            if (string.IsNullOrEmpty(actionUi.FinalActionsList.Value))
            {
                return;
            }

            //Removing children activities when configuring solution after returning to Solution Introduction
            if (ActivityPayload.ChildrenActivities.Count() > 0)
            {
                ActivityPayload.ChildrenActivities.RemoveAll(a => true);
            }

            // Always use default template for solution
            const string firstTemplateName       = "Monitor_DocuSign_Envelope_Activity";
            var          monitorDocusignTemplate = await HubCommunicator.GetActivityTemplate("terminalDocuSign", firstTemplateName);

            Guid secondActivityTemplateGuid;
            ActivityTemplateDTO secondActivityTemplate;

            if (Guid.TryParse(actionUi.FinalActionsList.Value, out secondActivityTemplateGuid))
            {
                secondActivityTemplate = await HubCommunicator.GetActivityTemplate(Guid.Parse(actionUi.FinalActionsList.Value));
            }
            else
            {
                secondActivityTemplate = await GetActivityTemplateByName(actionUi.FinalActionsList.Value);
            }

            var firstActivity = await HubCommunicator.AddAndConfigureChildActivity(ActivityPayload, monitorDocusignTemplate);

            var secondActivity = await HubCommunicator.AddAndConfigureChildActivity(ActivityPayload, secondActivityTemplate, "Final activity");

            await HubCommunicator.ApplyNewToken(firstActivity.Id, Guid.Parse(AuthorizationToken.Id));

            firstActivity = await HubCommunicator.ConfigureActivity(firstActivity);

            ActivityPayload.ChildrenActivities[0] = firstActivity;

            return;
        }
        private async Task <ActivityPayload> ConfigureMonitorActivity(List <ActivityTemplateDTO> activityTemplates)
        {
            var template = activityTemplates.Single(x => x.Terminal.Name == "terminalDocuSign" && x.Name == "Monitor_DocuSign_Envelope_Activity" && x.Version == "1");
            var activity = await HubCommunicator.AddAndConfigureChildActivity(ActivityPayload, template, order : 1);

            await HubCommunicator.ApplyNewToken(activity.Id, Guid.Parse(AuthorizationToken.Id));

            activity = await HubCommunicator.ConfigureActivity(activity);

            ActivityConfigurator.SetControlValue(activity, "EnvelopeSent", "true");
            if (ActivityUI.SentToSpecificRecipientOption.Selected)
            {
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.recipient.RecipientValue", ActivityUI.SpecificRecipientEmailText.Value);
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.recipient", true);
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.template", false);
            }
            else if (ActivityUI.BasedOnTemplateOption.Selected)
            {
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.template.UpstreamCrate", ActivityUI.TemplateSelector.ListItems.Single(x => x.Key == ActivityUI.TemplateSelector.selectedKey));
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.recipient", false);
                ActivityConfigurator.SetControlValue(activity, "TemplateRecipientPicker.template", true);
            }
            return(await HubCommunicator.ConfigureActivity(activity));
        }
        private async Task <ActivityPayload> CreateSalesforceDataActivity(ReconfigurationContext context)
        {
            var getSalesforceDataActivityTemplate = (await HubCommunicator.GetActivityTemplates(null))
                                                    .First(x => x.Name == "Get_Data" && x.Terminal.Name == TerminalName && x.Version == "1");
            var dataSourceActivity = await HubCommunicator.AddAndConfigureChildActivity(
                context.SolutionActivity,
                getSalesforceDataActivityTemplate,
                order : 1);

            if (dataSourceActivity.CrateStorage.Where(a => a.ManifestType.Id == (int)MT.StandardAuthentication).FirstOrDefault() != null)
            {
                await HubCommunicator.ApplyNewToken(dataSourceActivity.Id, Guid.Parse(AuthorizationToken.Id));

                dataSourceActivity = await HubCommunicator.ConfigureActivity(dataSourceActivity);
            }

            //This config call will make SF Get_Data activity to load properties of the selected object (and removes filter)
            CopySolutionUiValuesToSalesforceActivity(context.SolutionActivity, dataSourceActivity);
            dataSourceActivity = await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, dataSourceActivity);

            //This config call will set the proper filter value for the selected object
            CopySolutionUiValuesToSalesforceActivity(context.SolutionActivity, dataSourceActivity);
            return(await HubCommunicator.ConfigureChildActivity(context.SolutionActivity, dataSourceActivity));
        }