Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

I am using bean shell to duplicate data as below. But it only copy the data from field not the file upload by applicant. How to duplicate/load the file that upload by the applicant before.


import org.joget.apps.form.model.Form;
import org.joget.apps.form.model.Element;
import org.joget.apps.form.model.FormData;
import org.joget.apps.form.model.FormRow;
import org.joget.apps.form.model.FormRowSet;
import org.joget.commons.util.LogUtil;
import org.joget.apps.form.lib.WorkflowFormBinder;

public FormRowSet loadData() {
FormRowSet rows = null;

WorkflowFormBinder binder = new WorkflowFormBinder();

String duplicateId = "#requestParam.duplicate_id#";
if (!duplicateId.isEmpty() && !duplicateId.contains("requestParam.")) {
rows = binder.load(element, duplicateId, formData);
FormRow row = rows.get(0);
row.setId(null);
row.remove("reference_id");
} else {
rows = binder.load(element, primaryKey, formData);
}

return rows;
}

return loadData();