Passing Record IDs as a URL Parameter in Forms
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.
- From the form record's Detail page, click Related to access the Field Groups related list.
- Click the link for the desired Field Group. This will open the Field Group Detail page.
- From the Field Group Detail page, in the URL, copy the Field Group ID. (This is the number at the end of the URL.)
- Paste the Field Group ID into a document or notepad to use later.
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.
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
- Add an & after the Form URL. For example: https://us-tdm-tso-15a4c72a896.force.com/cpbase__form?ID=a0S46000000J3Rj&
- Append the following to the end of the Field Group ID_SOQL= For example: a0O46000000T9ef_SOQL=
- 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'
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%27Create 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.