AnsweredAssumed Answered

Form Processor not able to generate form

Question asked by les21 on Jun 5, 2017
Latest reply on Jun 5, 2017 by les21


I'm trying to display a custom form using Alfresco.util.PopupManager.displayForm() however I'm having an issue trying to use my own form processor. It works without a hitch if I use the itemKind: "type", so the type processor but if I try to use my own "adduser" processor it just shows a blank form.



        title: "Select Users",
            mode: "create",
            itemKind: "adduser",
            itemId: "scwf:adduser",
            showCancelButton: "false"
            fn: function()
                // do something if successful
            scope: this
        successMessage: "Update of node " + workflowid + " was successful.",
            fn: function()
                // do something if failure
            scope: this
        failureMessage: "Update of node " + workflowid + " failed."

The form is defined in xml and I know that my processor is correctly registering because I can see log messages in the console, here is my generate() code in the form processor.



public Form generate(Item item, List<String> fields, List<String> forcedFields, Map<String,Object> context){
     //we are going to fool it into thinking it's generating a type form, then switch the url under it
     //Form f = super.generate(item, fields, forcedFields, context);
     Form f = new Form(item);
     Item formItem = f.getItem();
     Object itemData = makeItemData(item);
        FormCreationData data = new FormCreationDataImpl(itemData, forcedFields, context);
        populateForm(f, fields, data);
        FormData de = new FormData();
        de.addFieldData("assoc_scwf_assignees", "");
        f.addField(new PersonField(KEY1_FORM_FIELD, "Attribute key1 - mandatory", "Key1", true));
        logger.debug("Ye: " + f.getItem());
       return f;   
protected Object makeItemData(Item item) {
        // Return the attribute item with optionally the value set
        return item;

This code is suppose to be generating a form that looks like the xml definition:


<config evaluator="string-compare" condition="scwf:adduser">
     <show id="scwf:assignees" force="true" />
     <set id="" appearance="title" label-id="workflow.set.general" />
     <set id="items" label="Document" />
     <set id="other" label="Review Outcome" />
     <set id="assignee" label-id="workflow.set.assignees" />
     <set id="response" label-id="workflow.set.response" />
     <field id="scwf:assignees" label-id="workflow.field.reviewers" set="assignee">
         <control template="/org/alfresco/components/form/controls/authority3.ftl">
       <control-param name="compactMode">false</control-param>
       <control-param name="forceEditable">false</control-param>


So in other words it just needs to contain one field, the authority.ftl field (in this case I modified it via form control). What am I doing wrong?