Date: Tue, 19 Mar 2024 05:51:45 +0000 (UTC) Message-ID: <452673675.95778.1710827505971@ip-10-0-0-39.us-west-2.compute.internal> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_95777_1446167575.1710827505968" ------=_Part_95777_1446167575.1710827505968 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Add a Hidden Field to the first form, set= the ID to "id" and add in the following value i= nto Default Value. The first form meant here is the o= ne that it mapped to the Run Process entity in t= he process activity mapping.
#reques= tParam.recordId#
This is so that, if there's existing record being loaded, when the= new process instance is created, the process instance will refer to this v= ery record subsequently.
In the same form, create a new section, leave it empty. Edit the sec= tion, set the Load Binder to Bean S= hell Form Binder. Insert the following code into it.
import = org.joget.apps.form.lib.SaveAsDraftButton; import org.joget.apps.form.lib.CustomHTML; import org.joget.apps.form.model.Column; import org.joget.apps.form.model.Element; import org.joget.apps.form.model.FormAction; import org.joget.apps.form.model.FormData; import org.joget.apps.form.model.Section; import org.joget.apps.form.service.FormUtil; import java.util.ArrayList; import java.util.Collection; Collection formActions =3D new ArrayList(); String saveButtonLabel =3D "Save As Draft"; Element saveButton =3D new SaveAsDraftButton(); saveButton.setProperty(FormUtil.PROPERTY_ID, "saveAsDraft"); saveButton.setProperty("label", saveButtonLabel); formActions.add(saveButton); Section section =3D element; ArrayList columns =3D (ArrayList) section.getChildren(); Column column =3D columns.get(0); column.setProperty("horizontal", "true"); column.setChildren(formActions); //add a custom html to fix the layout issue Element html =3D new CustomHTML(); String script =3D "<script>$(document).ready(function(){"; script +=3D "$(\"#"+section.getPropertyString("id")+"\").find(\".form-cell\= ").prependTo(\"#section-actions .form-column\");"; script +=3D "$(\"#"+section.getPropertyString("id")+"\").remove();"; script +=3D "});</script>"; html.setProperty("id", "button_layout_fixes"); html.setProperty("label", ""); html.setProperty("value", script); formActions.add(html); return null;
In the Userview, add a Run Process, name the&n= bsp;Custom ID to something meaningful, e.g. "= startApplication". Set the label appropriately, e.g. "Star= t Application".
Why are we doing this?
This is so that user can start a new process instance.
Set the label to "Edit".
Why are we doing this?
This is so that user can access the drafts applications that they have a= lready started.
What's next?
The list may be showing all the drafts started by all other users. You m= ay want to edit the list in Datalist Builder to only show = entries from the person that initiated it. See Advanced Form Data Binder on how to f= ilter the list.