Using the Response Output feature in ProntoForms allows you to capture details about a submission that just occurred and then pass some crucial information along to the next destination to use. Some examples of when you can do using the same technique would be to create a new Contact in Salesforce and then use that contact as the contact on a new case. Or create a new account and use it as the account on a case.
The example that I am going to show today is adding a PDF submission to an Account and then editing the Description field of the File record in Salesforce.
Enterprise Tier (for the Salesforce connections)A Salesforce EnvironmentConnection created to desired Salesforce environment
A Salesforce report or query set up as a data source. Depending on your end goal, the reports that are required as data sources might be different.
A form built in ProntoForms to initiate the submission and prompt for Account Name and description.
2 Salesforce destinations; 1 for adding the PDF to the account, the other to update the fields on the PDF
The most simple way to pull information from Salesforce is using a Salesforce Report. You can find information about that here.In my case, my report I have account name and account id columns which is all I will really need for this example. The ID is very important here as we will need to use it to tell ProntoForms which account we want to add the PDF, Salesforce does not recognize just the name.
My form in this example is very very simple. I have a dropdown to select the Account which is being driven from the Salesforce Report, a hidden ID field that is getting automatically populated based on the Account that was chosen and a text field to get something to update the Description field with. This is just a simple example and a lot more information can be added into the form and subsequently Salesforce.
2 different Salesforce Destinations are required to perform this action. The reason that we need 2 of them is because we are affecting 2 different objects. When we submit the PDF and attach it to the Account, the destination responsible for that will return the ID of the file that was added, which we can then use to update fields in the new file in the second destination. NOTE: The order that the destinations are in the form matters greatly. The PDF needs to be written first, then we can update fields on it.
On this destination, you only need to worry about the "Update Query" unless you want to update any of the other account fields at the same time as adding the PDF.Using the Salesforce Account Destination, navigate to the Update Query tab and Update the "Update Handling" to your desired outcome, and add a row under Query Option. The default Salesforce Field for an account ID in the Account object is just "Id'. There are many options in this set up, below is what I used.
Once the Update Query is ready to go, navigate to the "Response Configuration" tab and select "Store all response outputs for use in later destinations", we will need this later. At this point, add the destination to your form and submit the form once. We just need this to be able to see the Response Output that gets sent back. More info on that here. Mine looks like this:
The object that holds the PDF (or all files) in SalesForce is the "ContentVersion" object so for our second destination, we will use the Salesforce Standard, Custom, or Big Object type.On this destination we will use the Response Output to tell Salesforce which file we want to change up. Response Outputs are visible once the destination has been run and then you can use some values in a later destination. Using the screenshot above, the ID that we need is the "ContentDocumentId" as that is the ID for the file that was just uploaded. Using that we will need to build a small DREL expression, and we will use it in the "Update Query" of the 2nd destination.Set up the Salesforce Object Fields with the object you are writing to (ContentVersion in this case) and include the Salesforce Field that you want to update. I am updating Description in this case.
Under the Update Query tab, specify how you want to handle updates with the Update Handling. Add a row to the Query Options and this is where we will use DREL to use the response output from the other destination. %o to specify "output", first brackets are the Unique ID of the destination we want the response from and the second brackets are the ID of the item from the Response you want to reference.
With everything setup like above, when the form is submitted, the PDF should attach to the Account Specified in the Form and the file description will update to what was input into the form. This is just 1 example of what is possible, the options are endless as long as you plan right!!
As always - feel free to reach out if there are any questions or share with us some other cool work flows that you have created using Response Outputs on your destinations!