public override async Task FollowUp()
        {
            //In Follow Up config, Get Fields of the user selected object(ex., Lead) and populate Text Source controls
            //to let the user to specify the values.

            //if user did not select any object, retur the activity as it is
            string chosenObject = ExtractChosenSFObject();

            if (string.IsNullOrEmpty(chosenObject))
            {
                return;
            }

            if (Storage.CratesOfType <FieldDescriptionsCM>().Any(x => x.Label.EndsWith(" - " + chosenObject)))
            {
                return;
            }

            var chosenObjectFieldsList = await _salesforce.GetProperties(chosenObject.ToEnum <SalesforceObjectType>(), AuthorizationToken, true);

            //clear any existing TextSources. This is required when user changes the object in DDLB
            ConfigurationControls.Controls.RemoveAll(ctl => ctl is TextSource);
            chosenObjectFieldsList.ToList().ForEach(selectedObjectField =>
                                                    AddControl(UiBuilder.CreateSpecificOrUpstreamValueChooser(selectedObjectField.Label, selectedObjectField.Name, string.Empty, addRequestConfigEvent: true, requestUpstream: true)));

            Storage.RemoveByLabelPrefix("Salesforce Object Fields - ");
            Storage.Add("Salesforce Object Fields - " + chosenObject, new FieldDescriptionsCM(chosenObjectFieldsList));
        }
        private async Task ConfigureSolutionActivityUi()
        {
            var selectedObject = ActivityUI.SalesforceObjectSelector.selectedKey;

            if (string.IsNullOrEmpty(selectedObject))
            {
                Storage.RemoveByLabel(QueryFilterCrateLabel);
                this[nameof(ActivityUi.SalesforceObjectSelector)] = selectedObject;
                return;
            }
            //If the same object is selected we shouldn't do anything
            if (selectedObject == this[nameof(ActivityUi.SalesforceObjectSelector)])
            {
                return;
            }
            //Prepare new query filters from selected object properties
            var selectedObjectProperties = await _salesforceManager.GetProperties(selectedObject.ToEnum <SalesforceObjectType>(), AuthorizationToken);

            var queryFilterCrate = Crate <FieldDescriptionsCM> .FromContent(
                QueryFilterCrateLabel,
                new FieldDescriptionsCM(selectedObjectProperties)
                );

            Storage.ReplaceByLabel(queryFilterCrate);
            this[nameof(ActivityUi.SalesforceObjectSelector)] = selectedObject;
        }
        public override async Task FollowUp()
        {
            //If Salesforce object is empty then we should clear filters as they are no longer applicable
            if (string.IsNullOrEmpty(SelectedChatter))
            {
                Storage.RemoveByLabel(QueryFilterCrateLabel);
                Storage.RemoveByLabel(SalesforceObjectFieldsCrateLabel);
                this[nameof(SelectedChatter)] = SelectedChatter;
                return;
            }
            //If the same object is selected we shouldn't do anything
            if (SelectedChatter == this[nameof(SelectedChatter)])
            {
                return;
            }
            //Prepare new query filters from selected object properties
            var selectedObjectProperties = await _salesforceManager.GetProperties(SelectedChatter.ToEnum <SalesforceObjectType>(), AuthorizationToken, false, PostedFeedCrateLabel);

            var queryFilterCrate = Crate <FieldDescriptionsCM> .FromContent(
                QueryFilterCrateLabel,
                new FieldDescriptionsCM(selectedObjectProperties));

            Storage.ReplaceByLabel(queryFilterCrate);

            var objectPropertiesCrate = Crate <FieldDescriptionsCM> .FromContent(
                SalesforceObjectFieldsCrateLabel,
                new FieldDescriptionsCM(selectedObjectProperties));

            Storage.ReplaceByLabel(objectPropertiesCrate);
            this[nameof(SelectedChatter)] = SelectedChatter;
            //Publish information for downstream activities
            CrateSignaller.MarkAvailableAtRuntime <StandardTableDataCM>(PostedFeedCrateLabel);
        }
Beispiel #4
0
        public override async Task FollowUp()
        {
            //If Salesforce object is empty then we should clear filters as they are no longer applicable
            var selectedObject = ActivityUI.SalesforceObjectSelector.selectedKey;

            if (string.IsNullOrEmpty(selectedObject))
            {
                Storage.RemoveByLabel(QueryFilterCrateLabel);
                this[nameof(ActivityUi.SalesforceObjectSelector)] = selectedObject;
                return;
            }
            //If the same object is selected we shouldn't do anything
            if (selectedObject == this[nameof(ActivityUi.SalesforceObjectSelector)])
            {
                return;
            }
            //Prepare new query filters from selected object properties
            var selectedObjectProperties = await _salesforceManager
                                           .GetProperties(selectedObject.ToEnum <SalesforceObjectType>(), AuthorizationToken);

            var queryFilterCrate = Crate <FieldDescriptionsCM> .FromContent(
                QueryFilterCrateLabel,
                new FieldDescriptionsCM(selectedObjectProperties));

            Storage.ReplaceByLabel(queryFilterCrate);

            this[nameof(ActivityUi.SalesforceObjectSelector)] = selectedObject;
            //Publish information for downstream activities
            CrateSignaller.MarkAvailableAtRuntime <StandardTableDataCM>(RuntimeDataCrateLabel, true)
            .AddFields(selectedObjectProperties).AddField(CountObjectsFieldLabel);

            // Update ExternalObjectHandle crate.
            var externalObjectHandle = new ExternalObjectHandleDTO()
            {
                Name         = selectedObject,
                Description  = $"Data from Salesforce '{selectedObject}' object",
                DirectUrl    = null,
                ManifestType = ManifestDiscovery.Default.GetManifestType <StandardTableDataCM>().Type
            };

            var externalObjectHandleCrate = Crate.FromContent(
                ExternalObjectHandlesLabel,
                new ExternalObjectHandlesCM(externalObjectHandle)
                );

            Storage.ReplaceByLabel(externalObjectHandleCrate);
        }
Beispiel #5
0
        public override async Task FollowUp()
        {
            string curSfChosenObject = ActivityUI.SalesforceObjectList.selectedKey;

            if (string.IsNullOrEmpty(curSfChosenObject))
            {
                return;
            }

            PackEventSubscriptionsCrate();

            CrateSignaller.ClearAvailableCrates();
            CrateSignaller.MarkAvailableAtRuntime <SalesforceEventCM>("Salesforce Event");
            var selectedObjectProperties = await _salesforceManager.GetProperties(curSfChosenObject.ToEnum <SalesforceObjectType>(), AuthorizationToken);

            CrateSignaller.MarkAvailableAtRuntime <StandardTableDataCM>(GenerateRuntimeDataLabel(), true).AddFields(selectedObjectProperties);
        }