AnsweredAssumed Answered

Custom Action with Parameter: How can I restrict the choice to a single user?

Question asked by heike on Dec 5, 2016
Latest reply on Dec 9, 2016 by douglascrp

I added a custom action to set the value of a custom property "contact person". Now I need a form control that let's the user choose an existing user. I tried authority.ftl, but that way it is possible to select groups as well as single users.

This is part of my share-config-custom.xml:


<!-- Actions -->
<config evaluator="string-compare" condition="DocLibActions">
    <action id="assign-contact-person" type="javascript" label="actions.assign-cp" icon="assign-cp">
      <param name="function">onActionFormDialog</param>
      <param name="itemKind">action</param>
      <param name="itemId">assign-cp</param>
      <param name="mode">create</param>
      <param name="destination">{node.nodeRef}</param>
      <param name="successMessage">message.assign-cp.success</param>
      <param name="failureMessage">message.assign-cp.failure</param>
        <permission allow="true">Write</permission>
    <actionGroup id="document-browse">
      <action index="500" id="assign-contact-person" />
    <actionGroup id="document-details">
      <action index="500" id="assign-contact-person" />

<config evaluator="string-compare" condition="assign-cp">
        <show id="contactPerson"/>
        <field id="contactPerson" label="Contact Person">
          <control template="/org/alfresco/components/form/controls/authority.ftl"/>

I would also follow a different approach, allowing end users to edit the custom property via "Edit Properties" - then I would need a custom constraint that makes sure that only existing user names can be selected. Is there any way to achieve this?