public ActivityUi(UiBuilder uiBuilder)
 {
     SmsNumber = uiBuilder.CreateSpecificOrUpstreamValueChooser("SMS Number", "SMS_Number", addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(SmsNumber);
     SmsBody = uiBuilder.CreateSpecificOrUpstreamValueChooser("SMS Body", "SMS_Body", addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(SmsBody);
 }
        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));
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     FeedTextSource  = uiBuilder.CreateSpecificOrUpstreamValueChooser("Chatter Message", nameof(FeedTextSource), requestUpstream: true, availability: AvailabilityType.RunTime);
     ChatterSelector = new DropDownList
     {
         Name     = nameof(ChatterSelector),
         Label    = "Get which object?",
         Required = true,
         Events   = new List <ControlEvent> {
             ControlEvent.RequestConfig
         }
     };
     ChatterFilter = new QueryBuilder
     {
         Name     = nameof(ChatterFilter),
         Label    = "Meeting which conditions?",
         Required = true,
         Source   = new FieldSourceDTO
         {
             Label        = QueryFilterCrateLabel,
             ManifestType = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     QueryForChatterOption = new RadioButtonOption
     {
         Name     = nameof(QueryForChatterOption),
         Value    = "Query for chatter objects",
         Controls = new List <ControlDefinitionDTO> {
             ChatterSelector, ChatterFilter
         }
     };
     IncomingChatterIdSelector = new UpstreamFieldChooser
     {
         Name   = nameof(IncomingChatterIdSelector),
         Source = new FieldSourceDTO
         {
             AvailabilityType = AvailabilityType.RunTime,
             ManifestType     = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     UseIncomingChatterIdOption = new RadioButtonOption
     {
         Name     = nameof(UseIncomingChatterIdOption),
         Value    = "Use this incoming value as chatter Id",
         Controls = new List <ControlDefinitionDTO> {
             IncomingChatterIdSelector
         }
     };
     ChatterSelectionGroup = new RadioButtonGroup
     {
         Name      = nameof(ChatterSelectionGroup),
         GroupName = nameof(ChatterSelectionGroup),
         Label     = "Which chatter to post to?",
         Radios    = new List <RadioButtonOption> {
             QueryForChatterOption, UseIncomingChatterIdOption
         }
     };
     Controls.Add(FeedTextSource);
     Controls.Add(ChatterSelectionGroup);
 }
Example #4
0
        /// <summary>
        /// Create EmailBody RadioButtonGroup
        /// </summary>
        /// <returns></returns>
        private ControlDefinitionDTO CreateEmailBodyTextSourceControl()
        {
            var control = UiBuilder.CreateSpecificOrUpstreamValueChooser(
                "Email Body",
                "EmailBody",
                addRequestConfigEvent: true,
                requestUpstream: true
                );

            return(control);
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     ChannelSelector = new DropDownList {
         Label  = "Select Slack Channel",
         Events = new List <ControlEvent> {
             ControlEvent.RequestConfig
         }
     };
     MessageSource = uiBuilder.CreateSpecificOrUpstreamValueChooser("Message", nameof(MessageSource), addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(ChannelSelector);
     Controls.Add(MessageSource);
 }
Example #6
0
            public ActivityUi(UiBuilder uiBuilder)
            {
                MessageSource = uiBuilder.CreateSpecificOrUpstreamValueChooser(
                    "Message",
                    nameof(MessageSource),
                    requestUpstream: true,
                    availability: AvailabilityType.RunTime);

                Controls.Add(PhoneNumber = new TextBox {
                    Label = "Phone Number"
                });
                Controls.Add(MessageSource);
            }
        //if the user provides a connection string, this action attempts to connect to the sql server and get its columns and tables
        public override Task FollowUp()
        {
            //Verify controls, make sure that TextBox with value exists
            ValidateControls();
            //In all followup calls, update data fields of the configuration store
            try
            {
                var connStringField = ConfigurationControls.Controls.First();
                var dropDownControl = ConfigurationControls.Controls.OfType <DropDownList>().FirstOrDefault();

                dropDownControl.ListItems = GetTables();
                if (!string.IsNullOrEmpty(dropDownControl.Value))
                {
                    string identityColumn = null;
                    GetIdentityColumn(connStringField.Value, dropDownControl.Value, identity =>
                    {
                        identityColumn = identity;
                    });
                    var textSourceControls = ConfigurationControls.Controls.OfType <TextSource>();
                    foreach (var control in textSourceControls.ToList())
                    {
                        RemoveControl <TextSource>(control.Name);
                    }
                    var columns = GetTableColumns(dropDownControl.Value);

                    foreach (var column in columns)
                    {
                        if (identityColumn != column.ColumnName)
                        {
                            var textSource = UiBuilder.CreateSpecificOrUpstreamValueChooser(column.ColumnName, column.ColumnName);

                            if (column.isNullable == false)
                            {
                                textSource.Required = true;
                            }
                            AddControl(textSource);
                        }
                    }
                }
                //var contentsList = GetFieldMappings();
                //Storage.RemoveByLabel("Sql Table Columns");
                //this needs to be updated to hold Crates instead of FieldDefinitionDTO
                // Storage.Add("Sql Table Columns", new KeyValueListCM(contentsList.Select(col => new KeyValueDTO { Key = col, Value = col })));
            }
            catch (Exception e)
            {
                AddErrorToControl();
            }

            return(Task.FromResult(0));
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     FeedParentIdSource            = uiBuilder.CreateSpecificOrUpstreamValueChooser("Feed Parent Id", nameof(FeedParentIdSource), requestUpstream: true, availability: AvailabilityType.RunTime);
     UseUpstreamFeedParentIdOption = new RadioButtonOption
     {
         Name     = nameof(UseUpstreamFeedParentIdOption),
         Value    = "Use this upstream value as Feed Parent Id",
         Controls = new List <ControlDefinitionDTO> {
             FeedParentIdSource
         }
     };
     UserOrGroupSelector = new DropDownList
     {
         Name  = nameof(UserOrGroupSelector),
         Label = "Post to which Chatter Person or Group?"
     };
     UseUserOrGroupOption = new RadioButtonOption
     {
         Name     = nameof(UseUserOrGroupOption),
         Value    = "Specify user or group",
         Controls = new List <ControlDefinitionDTO> {
             UserOrGroupSelector
         }
     };
     FeedParentSelectionGroup = new RadioButtonGroup
     {
         Name      = nameof(FeedParentSelectionGroup),
         GroupName = nameof(FeedParentSelectionGroup),
         Radios    = new List <RadioButtonOption> {
             UseUserOrGroupOption, UseUpstreamFeedParentIdOption
         }
     };
     Controls.Add(FeedParentSelectionGroup);
     FeedTextSource = uiBuilder.CreateSpecificOrUpstreamValueChooser("Feed Text", nameof(FeedTextSource), requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(FeedTextSource);
 }
        private void PackCrate_ConfigurationControls()
        {
            var fieldSelectChannel = new DropDownList()
            {
                Label    = "Select Slack Channel",
                Name     = "Selected_Slack_Channel",
                Required = true,
                Source   = null
            };

            var fieldSelect = UiBuilder.CreateSpecificOrUpstreamValueChooser(
                "Select Message Field",
                "Select_Message_Field",
                addRequestConfigEvent: true,
                requestUpstream: true
                );

            AddControls(fieldSelectChannel, fieldSelect);
        }
        public override Task Initialize()
        {
            var control = UiBuilder.CreateSpecificOrUpstreamValueChooser(
                "EnvelopeId",
                "EnvelopeIdSelector",
                "Upstream Design-Time Fields"
                );

            control.Events = new List <ControlEvent>()
            {
                new ControlEvent("onChange", "requestConfig")
            };

            var infobox = UiBuilder.GenerateTextBlock("This activity will try to get the envelope with the specified Envelope Id. If an envelope id is known at design-time then this activity will signal envelope tabs", "", "");

            Storage.Clear();

            AddControls(infobox, control);

            return(Task.FromResult(0));
        }
        public override async Task FollowUp()
        {
            if (!string.IsNullOrEmpty(ActivityUI.StatTypesList.Value))
            {
                var previousGroup = SelectedStatType;
                if (string.IsNullOrEmpty(previousGroup) || !string.Equals(previousGroup, ActivityUI.StatTypesList.Value))
                {
                    var propertyInfos = StatXUtilities.GetStatTypeProperties(ActivityUI.StatTypesList.Value);
                    ActivityUI.ClearDynamicFields();
                    foreach (var property in propertyInfos)
                    {
                        var t = property.PropertyType;
                        if (t.IsGenericType && typeof(IList <>).IsAssignableFrom(t.GetGenericTypeDefinition()) ||
                            t.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IList <>)))
                        {
                            //render corresponding FieldList control for properties that are collections
                            ActivityUI.AvailableStatItemsList.Add(CreateFieldListBasedOnStatType());
                        }
                        else
                        {
                            ActivityUI.AvailableStatProperties.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(property.Name, property.Name, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                        }
                    }
                }
                SelectedStatType = ActivityUI.StatTypesList.Value;
            }
            else
            {
                ActivityUI.ClearDynamicFields();
                SelectedStatType = string.Empty;
            }

            SelectedStatGroup = ActivityUI.ExistingStatGroupList.Value;
            ActivityUI.ExistingStatGroupList.ListItems = (await _statXIntegration.GetGroups(StatXUtilities.GetStatXAuthToken(AuthorizationToken)))
                                                         .Select(x => new ListItem {
                Key = x.Name, Value = x.Id
            }).ToList();
            ActivityUI.ExistingStatGroupList.Value = SelectedStatGroup;
        }
        public override async Task FollowUp()
        {
            if (!string.IsNullOrEmpty(ActivityUI.ExistingGroupsList.Value))
            {
                var previousGroup = SelectedGroup;
                if (string.IsNullOrEmpty(previousGroup) || !string.Equals(previousGroup, ActivityUI.ExistingGroupsList.Value))
                {
                    var stats = await _statXIntegration.GetStatsForGroup(StatXUtilities.GetStatXAuthToken(AuthorizationToken), ActivityUI.ExistingGroupsList.Value);

                    if (stats.Any(x => string.IsNullOrEmpty(x.Title)))
                    {
                        StatXUtilities.AddAdvisoryMessage(Storage);
                    }
                    else
                    {
                        if (Storage.CratesOfType <AdvisoryMessagesCM>().FirstOrDefault() != null)
                        {
                            ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                                Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                            }).ToList();
                        }
                        Storage.RemoveByLabel("Advisories");
                    }

                    ActivityUI.ExistingGroupStats.ListItems = stats
                                                              .Select(x => new ListItem {
                        Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                    }).ToList();

                    var firstStat = stats.FirstOrDefault();
                    if (firstStat != null)
                    {
                        ActivityUI.ExistingGroupStats.SelectByValue(firstStat.Id);
                        ActivityUI.StatTitle.TextValue = firstStat.Title;
                        ActivityUI.StatNotes.TextValue = firstStat.Notes;
                        var statDTO = firstStat as GeneralStatWithItemsDTO;
                        if (statDTO != null)
                        {
                            if (statDTO.VisualType == StatTypes.PickList)
                            {
                                ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser("Current Index", "CurrentIndex", requestUpstream: true, groupLabelText: "Available Stat Properties"));
                            }
                            else
                            {
                                foreach (var item in statDTO.Items)
                                {
                                    ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(item.Name, item.Name, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                                }
                            }
                        }
                        else
                        {
                            ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(string.IsNullOrEmpty(firstStat.Title) ? firstStat.Id : firstStat.Title, string.IsNullOrEmpty(firstStat.Title) ? firstStat.Id : firstStat.Title, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                        }
                    }
                }
                SelectedGroup = ActivityUI.ExistingGroupsList.Value;
                //refresh statx groups
                ActivityUI.ExistingGroupsList.ListItems = (await _statXIntegration.GetGroups(StatXUtilities.GetStatXAuthToken(AuthorizationToken)))
                                                          .Select(x => new ListItem {
                    Key = x.Name, Value = x.Id
                }).ToList();
                ActivityUI.ExistingGroupsList.Value = SelectedGroup;
            }
            else
            {
                ActivityUI.StatTitle.Value = string.Empty;
                ActivityUI.StatNotes.Value = string.Empty;
                ActivityUI.ExistingGroupStats.ListItems.Clear();
                ActivityUI.ExistingGroupStats.selectedKey = string.Empty;
                ActivityUI.ExistingGroupStats.Value       = string.Empty;
                SelectedGroup = string.Empty;
            }

            if (!string.IsNullOrEmpty(ActivityUI.ExistingGroupStats.Value))
            {
                var previousStat = SelectedStat;
                var stats        = await _statXIntegration.GetStatsForGroup(StatXUtilities.GetStatXAuthToken(AuthorizationToken), ActivityUI.ExistingGroupsList.Value);

                if (stats.Any(x => string.IsNullOrEmpty(x.Title)))
                {
                    StatXUtilities.AddAdvisoryMessage(Storage);
                }
                else
                {
                    if (Storage.CratesOfType <AdvisoryMessagesCM>().FirstOrDefault() != null)
                    {
                        ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                            Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                        }).ToList();
                    }
                    Storage.RemoveByLabel("Advisories");
                }

                if (string.IsNullOrEmpty(previousStat) || !string.Equals(previousStat, ActivityUI.ExistingGroupStats.Value))
                {
                    var currentStat = stats.FirstOrDefault(x => x.Id == ActivityUI.ExistingGroupStats.Value);
                    if (currentStat != null)
                    {
                        ActivityUI.ClearDynamicFields();
                        var statDTO = currentStat as GeneralStatWithItemsDTO;
                        if (statDTO != null && statDTO.Items.Any())
                        {
                            if (statDTO.VisualType == StatTypes.PickList)
                            {
                                ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser("Current Index", "CurrentIndex", requestUpstream: true, groupLabelText: "Available Stat Properties"));
                            }
                            else
                            {
                                foreach (var item in statDTO.Items)
                                {
                                    ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(item.Name, item.Name, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                                }
                            }
                        }
                        else
                        {
                            ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(string.IsNullOrEmpty(currentStat.Title) ? currentStat.Id : currentStat.Title, string.IsNullOrEmpty(currentStat.Title) ? currentStat.Id : currentStat.Title, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                        }
                    }
                }

                #region Refresh Stat Items to Track for Changes in app
                SelectedStat = ActivityUI.ExistingGroupStats.Value;
                ActivityUI.ExistingGroupStats.ListItems = stats.Select(x => new ListItem {
                    Key = string.IsNullOrEmpty(x.Title) ? x.Id : x.Title, Value = x.Id
                }).ToList();
                ActivityUI.ExistingGroupStats.Value = SelectedStat;
                var statToCheck = stats.FirstOrDefault(x => x.Id == SelectedStat);


                //check for changes in statValue Array
                if (statToCheck != null)
                {
                    ActivityUI.ExistingGroupStats.selectedKey = string.IsNullOrEmpty(statToCheck.Title) ? statToCheck.Id : statToCheck.Title;
                    var statDTO = statToCheck as GeneralStatWithItemsDTO;
                    if (statDTO != null && statDTO.Items.Any())
                    {
                        var oldStatNames = ActivityUI.StatValues.Select(x => x.Name).ToList();
                        var newStatNames = new List <string>();

                        if (statDTO.VisualType != StatTypes.PickList)
                        {
                            newStatNames = statDTO.Items.Select(x => x.Name).ToList();

                            //recreate new items
                            var newItems         = newStatNames.Where(x => !oldStatNames.Contains(x)).ToList();
                            var oldItemsToDelete = oldStatNames.Where(x => !newStatNames.Contains(x)).ToList();

                            foreach (var item in oldItemsToDelete.ToList())
                            {
                                var itemToDelete = ActivityUI.StatValues.FirstOrDefault(x => x.Name == item);
                                if (itemToDelete != null)
                                {
                                    ActivityUI.StatValues.Remove(itemToDelete);
                                }
                            }

                            foreach (var item in newItems)
                            {
                                ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(item, item, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                            }
                        }
                    }
                    else
                    {
                        var currentTextSource = ActivityUI.StatValues.FirstOrDefault()?.Name;
                        if (currentTextSource != (string.IsNullOrEmpty(statToCheck.Title) ? statToCheck.Id : statToCheck.Title))
                        {
                            ActivityUI.StatValues?.Clear();
                            ActivityUI.StatValues.Add(UiBuilder.CreateSpecificOrUpstreamValueChooser(string.IsNullOrEmpty(statToCheck.Title) ? statToCheck.Id : statToCheck.Title, string.IsNullOrEmpty(statToCheck.Title) ? statToCheck.Id : statToCheck.Title, requestUpstream: true, groupLabelText: "Available Stat Properties"));
                        }
                    }
                }

                #endregion
            }
            else
            {
                ActivityUI.StatTitle.Value = string.Empty;
                ActivityUI.StatNotes.Value = string.Empty;
                ActivityUI.ClearDynamicFields();
                ActivityUI.ExistingGroupStats.ListItems.Clear();
                ActivityUI.ExistingGroupStats.selectedKey = string.Empty;
                ActivityUI.ExistingGroupStats.Value       = string.Empty;
                SelectedStat = string.Empty;
            }
        }
        public override async Task FollowUp()
        {
            //Load DocuSign template again in case there are new templates available
            LoadDocuSignTemplates();
            var selectedTemplateId = SelectedTemplateId;

            //If template selection is cleared we should remove existing template fields
            if (string.IsNullOrEmpty(selectedTemplateId))
            {
                PreviousSelectedTemplateId = null;
                ActivityUI.ClearDynamicFields();
                Storage.RemoveByLabel(UserFieldsAndRolesCrateLabel);
                return;
            }
            if (selectedTemplateId == PreviousSelectedTemplateId)
            {
                return;
            }
            ActivityUI.ClearDynamicFields();
            PreviousSelectedTemplateId = selectedTemplateId;
            var docuSignConfiguration = DocuSignManager.SetUp(AuthorizationToken);
            var tabsAndFields         = DocuSignManager.GetTemplateRecipientsTabsAndDocuSignTabs(docuSignConfiguration, selectedTemplateId);
            var roles             = tabsAndFields.Item1.Where(x => x.Tags.Contains(DocuSignConstants.DocuSignSignerTag, StringComparison.InvariantCultureIgnoreCase)).ToArray();
            var userDefinedFields = tabsAndFields.Item1.Where(x => x.Tags.Contains(DocuSignConstants.DocuSignTabTag));
            var envelopeData      = tabsAndFields.Item2.ToLookup(x => x.Fr8DisplayType);

            //check for DocuSign default template names and add advisory json
            var hasDefaultNames = DocuSignManager.DocuSignTemplateDefaultNames(tabsAndFields.Item2);

            if (hasDefaultNames)
            {
                var advisoryCrate          = Storage.CratesOfType <AdvisoryMessagesCM>().FirstOrDefault();
                var currentAdvisoryResults = advisoryCrate == null ? new AdvisoryMessagesCM() : advisoryCrate.Content;

                var advisory = currentAdvisoryResults.Advisories.FirstOrDefault(x => x.Name == AdvisoryName);

                if (advisory == null)
                {
                    currentAdvisoryResults.Advisories.Add(new AdvisoryMessageDTO {
                        Name = AdvisoryName, Content = AdvisoryContent
                    });
                }
                else
                {
                    advisory.Content = AdvisoryContent;
                }

                Storage.Add(Crate.FromContent("Advisories", currentAdvisoryResults));
            }
            //Add TextSource control for every DocuSign role to activity UI
            ActivityUI.RolesFields.AddRange(roles.Select(x => UiBuilder.CreateSpecificOrUpstreamValueChooser(x.Key, x.Key, requestUpstream: true, specificValue: x.Value)));
            //Add TextSrouce control for every DocuSign template text field to activity UI
            ActivityUI.TextFields.AddRange(envelopeData[ControlTypes.TextBox].Select(x => UiBuilder.CreateSpecificOrUpstreamValueChooser(x.Name, x.Name, requestUpstream: true, specificValue: x.Value)));
            //Add RadioButtonGroup with respective options for every DocuSign template radio selection field to activity UI
            ActivityUI.RadioButtonGroupFields.AddRange(
                envelopeData[ControlTypes.RadioButtonGroup]
                .OfType <DocuSignMultipleOptionsTabDTO>()
                .Select(x => new RadioButtonGroup
            {
                GroupName = x.Name,
                Name      = x.Name,
                Label     = $"For the <strong>{x.Name}</strong>, use:",
                Radios    = x.Items.Select(y => new RadioButtonOption
                {
                    Name     = y.Value,
                    Value    = y.Value,
                    Selected = y.Selected
                })
                            .ToList()
            }));
            //Add CheckBox for every DocuSign template yes/no field to activity UI
            ActivityUI.CheckBoxFields.AddRange(envelopeData[ControlTypes.CheckBox].Select(x => new CheckBox {
                Name = x.Name, Label = x.Name, Selected = Convert.ToBoolean(x.Value)
            }));
            //Add DropDownList for every DocuSign template list selection field to activity UI
            ActivityUI.DropDownListFields.AddRange(
                envelopeData[ControlTypes.DropDownList]
                .OfType <DocuSignMultipleOptionsTabDTO>()
                .Select(x => new DropDownList
            {
                Name      = x.Name,
                Label     = $"For the <strong>{x.Name}</strong>, use:",
                ListItems = x.Items.Select(y => new ListItem
                {
                    Key      = string.IsNullOrEmpty(y.Value) ? y.Text : y.Value,
                    Value    = string.IsNullOrEmpty(y.Text) ? y.Value : y.Text,
                    Selected = y.Selected
                })
                            .ToList()
            }));

            Storage.ReplaceByLabel(Crate.FromContent(UserFieldsAndRolesCrateLabel, new KeyValueListCM(userDefinedFields.Concat(roles))));
        }