Exemple #1
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);
        }
Exemple #2
0
        private Crate CreateExternalObjectHandlesCrate()
        {
            var fileName = ExtractFileName(ActivityUI.FilePicker.Value);

            var externalObjectHandle = new ExternalObjectHandleDTO()
            {
                Name         = fileName,
                Description  = $"Table Data from Excel File '{fileName}'",
                DirectUrl    = ActivityUI.FilePicker.Value,
                ManifestType = ManifestDiscovery.Default.GetManifestType <StandardTableDataCM>().Type
            };

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

            return(crate);
        }