Fetch all users of a group in MultiSelectInput in aikau?

cancel
Showing results for 
Search instead for 
Did you mean: 
manav
Active Member II

Fetch all users of a group in MultiSelectInput in aikau?

Jump to solution

I am trying create form control which can fetch users from a particular group. From the link, I found that it can be achieved by MultiSelectInput form control. In that widget I am making a call to "api/groups/ALFRESCO_ADMINISTRATORS/children" service API which returns all users of the group.

{
   id: "MULTI_SELECT_1",
    name: "alfresco/forms/controls/MultiSelectInput",
    config: {
       label: "My multi-select input",
       name: "mySelect",
       width: "400px",
       choiceCanWrap: false, // Whether chosen items' text can wrap over multiple lines (defaults to true)
       choiceMaxWidth: "50%", // The maximum width of chosen items (defaults to 100%)
       optionsConfig: {
          labelAttribute: "Select", // What's displayed in the dropdown and choice (defaults to label)
          queryAttribute: "shortName", // The attribute that's used when filtering the dropdown (defaults to name)
          valueAttribute: "displayName", // The actual submitted value for each chosen item (defaults to value)
          publishTopic: "ALF_RETRIEVE_MULTISELECT_INFO",
          publishPayload: {
             uri: "api/groups/ALFRESCO_ADMINISTRATORS/children"
          },
          labelFormat: { // Optional label format strings (all default to item[this.store.labelAttribute] if not specified)
             choice: "shortName",
             result: "displayName",
             full: "shortName - displayName"
          },
          searchStartsWith: true // Whether the query attribute should start with the search string (defaults to false)
       }
    }
}

But I am not able to get any user multiselectinput. It would appreciate if anyone can help me to achieve this.

1 Solution

Accepted Solutions
hardik1512
Established Member II

Re: Fetch all users of a group in MultiSelectInput in aikau?

Jump to solution

You can use ALF_GET_FORM_CONTROL_OPTIONS  as topic. See below configuration.

{
                name: "alfresco/forms/controls/MultiSelectInput",
                config: {
                    label: "Admin users",
                    name: "people",
                    width: "360px",
                    optionsConfig: {
                        queryAttribute: "shortName",
                        publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
                        publishPayload: {
                            url: page.url.context + "/proxy/alfresco/api/groups/ALFRESCO_ADMINISTRATORS/children",
                            resultsProperty: "options",
                            itemsAttribute: "data",
                            labelAttribute: "displayName",
                            valueAttribute: "shortName"
                        }
                    }
                }
            }

View solution in original post

1 Reply
hardik1512
Established Member II

Re: Fetch all users of a group in MultiSelectInput in aikau?

Jump to solution

You can use ALF_GET_FORM_CONTROL_OPTIONS  as topic. See below configuration.

{
                name: "alfresco/forms/controls/MultiSelectInput",
                config: {
                    label: "Admin users",
                    name: "people",
                    width: "360px",
                    optionsConfig: {
                        queryAttribute: "shortName",
                        publishTopic: "ALF_GET_FORM_CONTROL_OPTIONS",
                        publishPayload: {
                            url: page.url.context + "/proxy/alfresco/api/groups/ALFRESCO_ADMINISTRATORS/children",
                            resultsProperty: "options",
                            itemsAttribute: "data",
                            labelAttribute: "displayName",
                            valueAttribute: "shortName"
                        }
                    }
                }
            }