AnsweredAssumed Answered

Post Request

Question asked by riadhazzouz on Mar 28, 2019
Latest reply on Apr 1, 2019 by riadhazzouz

I made this model 

 

<types>
      <type name="sp:configuration">
            <title>Configuration</title>
            <parent>cm:content</parent>
            <properties>
                  <property name="sp:username">
                        <type>d:text</type>
                        <mandatory>true</mandatory>
                  </property>
                  <property name="sp:users">
                        <type>d:text</type>
                        <multiple>true</multiple>
                  </property>
            </properties>
      </type>
</types>

 

I' m trying to make a form in which a user can choose a list of users, I tried this code in the js file of the new page

 

ConfigurationFormWidget = [
{
      name : "alfresco/forms/controls/MultiSelectInput",
      config : {
            label : "Select Users",
            name : "prop_config_users",
            optionsConfig : {
                  queryAttribute : "shortName",
                  publishTopic : "ALF_GET_FORM_CONTROL_OPTIONS",
                  publishPayload : {
                        url : page.url.context
                        + "api/groups/ALFRESCO_ADMINISTRATORS/children",
                  resultsProperty : "options",
                  itemsAttribute : "data",
                  labelAttribute : "displayName",
                  valueAttribute : "shortName"
                  }
            }
      }
}];

 

var form = {
      name: "alfresco/forms/Form",
      config: {
            showOkButton: true,
            okButtonLabel: "Save",
            showCancelButton: false,
            cancelButtonLabel: "",
            //Specify the TOPIC here
            okButtonPublishTopic: "ALF_CRUD_CREATE",
            okButtonPublishGlobal: true,
            okButtonPublishPayload: {
                  //Specify the URL here to POST the data
                  url: "/hdp/ws/configUserSpace",
                 //To create the folder under document library, we need the documberLibrary nodeRef,So POST that too.
                  alf_destination:alfDestination
            },
      widgets: ConfigurationFormWidget
      }
};

 

model.jsonModel.widgets.push(form);
/*************************************************************************************/

 

the issue is that the users are not being displayed in the MultiSelectInput, and I didn't find the URI to display all users not only ALFRESCO_ADMINISTRATORS.

Finally how can I make the POST request to send the data and save it in contents?

Outcomes