Are you drawing data from Salesforce into a repeated section? Good - come learn how you can reference the values from its items.
In the following example we will draw cases for the form filler.
We will also ask the filler to pick a case by pressing on the “Choose” button, and will then populate more data related to this case outside of the repeated section.
Follow the steps:
1- Set up some test data in your Salesforce account. Create 5 new cases that contain the word ‘Test’ in their subject.
2- Create a new blank form
3- Drag a Section element. Make it wider to fit 3 elements.
- Drag a Textbox, and change its label to: Case Name
- Drag a Button: and change its button text to: Choose
- Drag a Hidden element and change its name to : repeated_case_id
4- Drag another hidden field, but place it outside of the section.
We will use it to store the account id of the selected case.
Change its name to: Chosen_case_id
5- Select the ‘Choose’ button and change its type to a ‘Condition’
- Press on the ‘Set’ button.
- Find the ‘Chosen_case_id’ hidden field’ and choose ‘Set value from’ in the first dropdown, and the ‘repeated_case_id’ in the second dropdown.
- Press ‘Apply’.
6- Select the section and change it so it has 3 visible items.
this will make the section 3 times its height, so you better room for it.
- Move your submit button and "Chosen_case_id" hidden field to the bottom of the form, and move the Section up a bit.
- Go to ‘Properties’ panel > ‘Element’ tab > ‘Settings’ option > ‘Basic’ category
- Enter 3 in the "Num of visible items" textbox.
7- Set up the Get integration:
- Go to the ‘Properties’ panel > ‘Form’ tab > ‘Settings’ option > ‘Salesforce integration’ category > Get from Salesforce
- Press on the ‘Set Get’ button
- Choose the object: Case
- Turn on the 'Execute on form load' checkbox.
- In our example we’ll be drawing the 5 test cases we previously created, So open the ‘Condition’ category and press on the ‘Conditions’ button.
- Enter the following rule:
Subject Contains Other: Test
- Press on ‘Apply’.
- Choose ‘All’ option in the ‘If multiple matches found take ID from’ radio button and enter 5 in the ‘Limit’ input box.
- Open the ‘Map fields’ category and press on ‘Set mapping’ button.
- Map the form fields to your fields in the Case object:
case Name → Subject
Repeated_case_id → Case ID
- Press apply and save the form.
8- Now lets add a "Description" field that we can populate based on the case the filler chooses:
- Drag a Textarea element below the section
- Change its label to Description.
- Now go back to your Salesforce integration and add another Get integration line:
- Go to the ‘Properties’ panel > ‘Form’ tab > ‘Settings’ option > ‘Salesforce integration’ category > Get from Salesforce
- Press on the ‘Set Get’ button
- Choose the object: Case
- In the 'Condition' category - set the following rule:
Case ID Equals Chosen_case_id
- Press 'Apply' and open the 'Map fields' category.
- Configure the mapping:
Description --> Description
- Save your form.
9- Now it's time to test your form.
- Make your hidden fields visible (for debugging purposes - only you will be able to see them while you are logged in.)
- Go to the ‘Properties’ panel > ‘Form’ tab > ‘Settings’ option > Press 'view more' > ‘Debug mode’ category
- Turn on the 'Show hidden fields' checkbox.
- Publish your form as URL
You will now see that 5 cases are loaded and your hidden fields are visible (with a pink background) and showing the the cases' Ids.
- Press on the "Choose" button in the first repeated item line. you'll see that its ID is now also set in the Hidden field at the botton of the form, and
the description field is populated.