Boolean Example 2: using a hidden field
Before we start you should create some test data in your Salesforce account.
- Create a new account called: Test 2
- Enter a number in the Account phone field: 12345
- Create a checkbox field for the test (custom) called chkbox and leave it unchecked
Follow these steps:
1- | Create a new blank form |
2- | Drag a textbox and change its label to “account” |
3- |
Drag another textbox and change its label to “phone” |
4- | Drag a hidden field and change its label name to “checkbox_value” |
5- |
Drag a hidden field and change its label name to “account_id” |
6- | Now let’s set a Salesforce Get integration to populate the following: - the phone field (with the account phone) - the “checkbox_value” hidden field (with either a true/false value from the chkbox field) - the “account_id” hidden field (with the account ID for the “push” integration we will add later) |
Get integration |
|
7- | Go to properties panel > Form tab > Settings option > Salesforce integration > Get from Salesforce > Press on ‘Map fields’ button |
8- | Authenticate with Salesforce |
9- |
Select an object: Account |
10- | Set a condition: Account Name equals account |
11- |
Map fields: Phone → Account phone account _id → Account ID |
12- |
Press ‘Apply’ and save the form |
13- | Now let’s add a condition that if the phone field contains 1 then set the value ‘true’ inside the checkbox_value hidden field. - Select the phone field on canvas - Goto properties panel > Element tab > Settings option > Conditioning And press on the ‘Configure conditions’ button. - Set this condition: Current field Contains 1 → results: checkbox_value → Set value: true |
Please note! When setting the condition please make sure to write ‘true’ in lowercase. because boolean values in Salesforce are case-sensitive. |
|
14- | Now let’s set a Salesforce Push integration to update the following back in Salesforce: - account phone - our checkbox field in Salesforce (with the ‘true’ value in the hidden) |
Push integration |
|
15- | Go to properties panel > Form tab > Settings option > Salesforce integration > Push to Salesforce > Press on ‘Set notification’ button. |
16- | Select object: Account - Select an Action: Update - set the following condition: Account ID Equals account_id - Choose ‘First’ in the ‘If multiple matches found take ID from’ radio button And choose ‘Create’ in the ‘if not found any match’ radio button. |
17- |
Map fields: Account Phone → phone Chkbox → checkbox_value |
18- |
Go to ‘properties’ panel > ‘Form’ tab > ‘Settings’ option > (Press on ‘View more’) > Open the ‘Debug mode’ category - Turn on the ‘Show hidden fields’ checkbox. This will enable you to see the Hidden fields and the values stored in them when you are testing the form. |
19- |
Now it’s time to test your form. - Publish it as URL - Enter the test account name: Test 2 You will then see that the phone field is populated with 12345, the 'account_id' hidden is populated with the account ID And the 'checkbox_value' hidden now stores the value ‘true’ - because of the condition we created. - Change the phone number to: 333333 and press on ‘Submit’ button. - All that is left now is to check that the data was indeed updated in Salesforce. Open the ‘Test 2’ account and you will see that the phone number has changed to 333333 and the chkbox field is now checked. |