In Form Builder, you can covert a SOQL query to a URL parameter that will display data to the end user by passing a SOQL filter in the URL. This can be used if, for example, you have a form that maps to a Custom Object but not to a specific Record ID. If you'd like to use at form that connects to a specific Record ID, you can append the SOQL query with a specific Record ID defined and add it to the end of the Form URL.  

Pass a SOQL Filter using a URL Parameter

Example Scenario: We've created a form that is mapped to a Custom Object, Post Event Survey and the Attendee ID field included in the Field Group. We'd like to send out the Post Event Survey  Form to our event attendees so they can complete the survey and  associate their responses with their Attendee Record ID. However, the attendees do not have login credentials to the Community Portal, so we cannot map the SOQL Filter directly in the Form itself. This requires the SOQL query be converted to a URL parameter. It will allow us to create a unique URL for each attendee that they can use to complete the form. This unique URL will map their responses to their unique Attendee ID without having to log in to the portal.


  1. From the form record's Detail page, click Related to access the Field Groups related list. 
  2. Click the link for the desired Field Group. This will open the Field Group Detail page.



  3. From the Field Group Detail page, in the URL, copy the Field Group ID. (This is the number at the end of the URL.) 



  4. Paste the Field Group ID into a document or notepad to use later.
  5. Return to the existing Form's Detail page and copy the Form URL.


    Note

    If you do not see this field, edit your page layout to display it.


  6. Paste the Form URL into a document or notepad to use later.

    Note

    If you have not created the Form URL field yet, you will need to create a fomula text field:

    When creating the field, the formula for the field should be: "https://yourcommunityurl/cpbase__form?id=" & Id  

    Example: "https://mdtest.force.com/cpbase__form?id=" & Id

  7. Add an & after the Form URL. For example: https://us-tdm-tso-15a4c72a896.force.com/cpbase__form?ID=a0S46000000J3Rj&
  8. Append the following to the end of the Field Group ID_SOQL= For example: a0O46000000T9ef_SOQL=
  9. Define the SOQL filter you'd like to use. This is used to filter the desired results you'd like to display in the Form. For example: AttendeeID= 'a0M610000005KbY'
  10. Encode the SOQL query by navigating to http://meyerweb.com/eric/tools/dencoder/. This is done by [Pasting] the SOQL Filter (Id= 'a0M610000005KbY') into the Encoder and clicking the Encode button. Copy the Encoded SOQL Filter to use in next step.

    Note

    Before Encoding: Id= 'a0M610000005KbY'
              After Encoding: Id%3D%20%27a0M610000005KbY%27

  11. Create your Unique Form URL by adding the Form URL, the Field Group, and encoded SOQL filter together. The Formula is FormURL& + Field Group ID_SOQL= + Encoded SOQL filter.

    Note

    For example, https://us-tdm-tso-15a4c72a896.force.com/cpbase__form?ID=a0S46000000J3Rj&a0O46000000T9d8_SOQL=Id%3D%20%27a0M610000005KbY%27

You have now created a unique form url that connects to a specific attendee ID without having the user login to the portal.