function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tyler Brooks 16Tyler Brooks 16 

Button on an object to open a FormAssembly form linked to said object

Hello all,
I am trying to create a button on an object that will open a FormAssembly form, prepopulating several fields from the object into it. Then it will create a new object as a child of the first.

I found something like this for sending an email template out, 
<a href="formURL?tfa_co={!Lead.Company}&tfa_LeadId={!Lead.Id}">Please click here to take our survey.</a>

COuld this convert to a button on my record page? I am a new(er) admin on my own and I've never done a button or FormAssembly before.
 
Best Answer chosen by Tyler Brooks 16
Sam KesslerSam Kessler
Hi Tyler, When configuring the prefill connector to read a variable from the form url, it's usually best to set it to read from an "unsafe query parameter." First I would recommend you change the name of the parameter you're passing from tfa_158 to something custom like "id" to prevent interference with formassembly's existing field aliases. I would recommend something like https://tsk-tsk.tfaforms.net/forms/view/5?id={!Opportunity.Id}. Then in the prefill connector, set it to look up an Opportunity where Opportunity ID equals "an unsafe query parameter" and then type in the name of your parameter (i.e. id). Best, Sam

All Answers

Sam KesslerSam Kessler
Hi Tyler! There are a few options for the things you're trying to do - I'll try and organize below:

Add a button with a link:
1. You could create a custom formula field on your object that generates a hyperlink sending along your lead ID. To do this, create a custom formula field of output type 'text' and use the HYPERLINK formula to build the link. An example formula using your example url would be: HYPERLINK("formURL?tfa_co=?custom_id="&Company&"&tfa_LeadId="&Id,"Submit Lead Form")

2. You could use the standard "Custom Button or Link" functionality to add a custom button or link to your page. In the setup menu, there should be an option for "Buttons, Links, and Actions" where you can add a custom button or link with your desired target url. Similar to the above, these will allow you to insert fields from your record as merge tags.

FormAssembly prefills:
1. My personal preferred method is to use the FormAssembly Salesforce Prefill Connector (you can add this to your form by going to the form menu, selecting "Connectors", and selecting the Salesforce Prefill to fire on the "Form Opened" action. This lets you use data from the url to look up a record in your SFDC instance and prefill fields on your form with any data from that record. I like this solution because you only need to pass a single unique ID in your form url, and you can set the connector to grab the rest of the data you need, so you don't need to build out long url formulae to prefill multiple fields on the form.

2. You could also prefill the specific fields on the form directly using their field aliases. For example, if you have a "first name" field with alias "tfa_1" you could set tfa1="Test" in your url to prefill that field with the text value "Test." This works, but requires you to make sure you're specifying values for each field you want to prefill, which can be a little tedious and more error-prone.

Hope this helps!
Tyler Brooks 16Tyler Brooks 16
Sam, thank you so much, that is great info and detail! I was able to create the custom button and pass the record ID into the form, which is awesome! I would prefer the Salesforce Prefill Connector as well, as there are several pieces of info I want to pull and would rather have that configuration in FormAssembly where others could easily make changes to it, rather than having to edit HTML buried in a button. 
What I have now is a custom button opening https://tsk-tsk.tfaforms.net/forms/view/5?tfa_158={!Opportunity.Id}. 
My question is how do i get the connector to use the Opportunity record I am sending? I have tried Opportunity ID equals Formula:{!Opportunity.Id}, as well as Opportunity ID equals Formula:tfa_158 (the LeadID field I am populating) but neither fills any of the other fields in. Thanks again and if you can help me on this hurdle I should be golden and will owe you many cold beverages :)
Sam KesslerSam Kessler
Hi Tyler, When configuring the prefill connector to read a variable from the form url, it's usually best to set it to read from an "unsafe query parameter." First I would recommend you change the name of the parameter you're passing from tfa_158 to something custom like "id" to prevent interference with formassembly's existing field aliases. I would recommend something like https://tsk-tsk.tfaforms.net/forms/view/5?id={!Opportunity.Id}. Then in the prefill connector, set it to look up an Opportunity where Opportunity ID equals "an unsafe query parameter" and then type in the name of your parameter (i.e. id). Best, Sam
This was selected as the best answer
Tyler Brooks 16Tyler Brooks 16
Sam, you are the man! Thank you so much!!
If you are ever in C-Bus or going to Dreamforce this year then I will make good on those beverages!

Have a great one!!