Below is an example to help you understand how you can configure a form design in a way that, when a user views a form of a particular type, they can create a new form of a similar type along with prepopulated data based on the original form and related attachments or associations as applicable.
Suppose there is a form type called 'Site Information' where we are capturing a title, location details and task details using different fields in 'Create View' as follows:
Title - A 'text box' field with field name 'ORI_FORMTITLE'.
Location - A 'text box' field with field name 'Task_Location'.
Reference - A 'text box' field with field name 'Task_Reference'.
Date - A 'date picker' field with field name 'Task_Date'.
Task Details - A 'text area' field with field name 'Task_Details'.
Here, the user can copy the above form details while viewing an existing 'Site Information' form to a new form of the same type (i.e. Site Information) and also associate the form that is being viewed with the new form as a reference. Below are the steps to be followed:
From the 'Create View', go to the copy dropdown at top right and select 'Copy All'.
Create a new view called 'Created View' and then go to the paste dropdown at top right and select 'Paste as Read-only'.
Add a new 'Button' field with the field name 'Copy_and_Associate' and label it as 'Copy and Associate with a New Task'. The new view should then look as follows:
Below are the steps to use the drag and drop code editor to define a condition upon the 'onClick' event of the 'Copy_and_Associate' button field, in 'Created View':
Here, we have used the custom function 'Launch Form - Target Setup'. In the corresponding dropdown, we have selected 'Current Project' and the form name as 'Site Information'.
Next, we have used the custom function 'Launch Form Field Mapping'. In the corresponding dropdown, we have set the source and target fields for mapping for each of the available fields separately based on their field name.
It is necessary to use identical values as 'Field Name' and 'Data Field Name', especially for fields within a repeating table or the entire repeating table when configuring such scripts in your form design.Additionally, a checkbox option called 'Associate Source Form' is selected, which means we are also associating the source form with the new form getting created.
While viewing the form, the user can click on the button named 'Copy and Associate with a New Task'. It would launch a new form with the data auto-populated from the previous form, along with attachments or associations as per the selected option in form design.
Next Article: Project Forms Navigation