Calculated Values
You can use calcaluted values for a form by adding the calculatedValues array to the form definition. An example is below. Name value is calculated based on the answers to the First Name and LastName (a space between them). You can also use fixed texts for a question, as in the example of Company feild below whose value will always be "Individual". Calculated values can benefit Java Script functions. CloseDate field/question below for example add 6 months to the current day.
"calculatedValues": [ { "name": "Name", "expression": "{FirstName} + ' ' + {LastName}", "includeIntoResult": true }, { "name": "Company", "expression": "Individual", "includeIntoResult": true }, { "name": "StageName", "expression": "Prospecting", "includeIntoResult": true }, { "name": "CloseDate", "expression": "dateAdd(today(), 6, 'months')", "includeIntoResult": true } ]
Calculated values are extremely important to use pieces of information (that are fixed or calculated based on the answers to other questions) that will not be asked or displayed on the form but will be used on jobs. For example, the example above is needed to send some required fields to Salesforce. They are required but relevant to the users. So we cannot add Name, Company, StageNam and CloseDate fields to the form. Instead we define them as calculated values so that now if we use Transfer job to send the form data to Salesforce, for example, these fields will also be sent to Salesforce API end point (in addition to answers to the other, normal questions).
Last updated