After reading this article, you will understand how to create a publicly accessible form that allows individuals to create Cases in your Salesforce environment
In this tutorial, you will learn how to create a public-facing form for your Salesforce Community, website, or anywhere else you might want users to fill out information and submit it to Salesforce. In this specific scenario, we'll be creating a form that generates a Case for a service representative to review and triage.
Reasons why you might want to use Youreka instead of a standard Web-2-Case form (or any other web form provider) would be:
- You require your form provider to be Salesforce native
- Your forms need conditional display logic and multiple pages
- Your forms need the ability to contain attachments which will be loaded to Salesforce
- Your forms might have questions that don't necessarily need to be mapped to fields, and you'd rather not create custom fields to capture all of the data
As we go through the tutorial, we'll be addressing the following list of requirements:
- The form will be made available on a website / Salesforce community
- The form will be accessible to anyone
- The form will always generate a new Case record in Salesforce when it is submitted
- The form will collect answers to many different questions, as well as allow users to submit documents / attachments
- The form will be styled to meet brand guidelines
- The newly generated Case will automatically be associated with any Contact in the system that has a matching email address (just like in a standard Web-2-Case form).
Step 1: Create a Form Template
Navigate to App Launcher > Youreka > Form Templates > New Form Template to create a new Form Template record. Name this Form Template "New Case Form", or something of the like.
Drag and drop questions onto the editor. Be sure to include the following field link questions. Remember, field links connect the questions on your form to fields on your Salesforce objects. Not all questions on your form need to be mapped to the Case, but these ones are pretty important for a Web-2-Case use case, so we'll add them.
- Email Address
- Phone Number
In this example, we also chose to add several more questions to the form, which can be seen in the GIF above. Every use case a little bit different, but you can feel free to copy our form by looking at the GIF, or you can download the form template and then import it into your Salesforce environment.
Next, select Allow New Records in the top lefthand corner. Make sure that the form template is allowing a new Case to be created.
You can also optionally create a Discovery by clicking the Continue button in the top right corner. If you don't see it, be sure to click Show Smart Features. In this example, we're choosing to automatically make a Discovery when the form submitter indicates they want to learn more about different product offerings. You can learn more about Discoveries by clicking here.
Once all of this is complete, you can Save the form template, and then click Publish. Once the template is published, you will now be able to make it available to your end users.
Another optional step would be to add custom CSS to your form, to align with specific brand guidelines. you can learn how to add CSS to your form templates by clicking here. In our case, we wanted a background image of some mountains, so we used the following CSS code to make that happen. Feel free to copy this, or tweak it to make your own style!
background: url('https://2j5zg2h1itk3tosw21k7acb1-wpengine.netdna-ssl.com/wp-content/uploads/2018/06/formBgImage.jpg') no-repeat top left;
text-shadow: 2px 2px #d3d3d3;
Step 2: Making the Form Available on a Public Site
In this step, we'll be setting up your Salesforce environment to basically "host" this form for anyone and everyone that needs to fill it out. The Youreka Knowledge Base already has several articles that explain how this process works, so we'll rely on them to complete this step. Make sure not to skip any of these - each of them is pretty important.
- Introduction to External Facing Forms
- Setting up a Salesforce Public Site
- Create a Link to Your Form
After all of this is said and done, we ended up with a URL like this:
This URL is a link to our public-facing form, and contains parameters that tell Youreka to create a new Form record when the link is clicked, use a specific Form Template ID (the template ID we created in step 1), and create a new Case record.
Step 3: Test Your URL
Paste your form URL into your browser, and double check that you are navigated to your form. If you've been following the instructions above, your URL should take you to a blank form, where you can fill out each question and then click submit. Here are a few things to keep in mind:
- If you chose to use CSS, verify that the form looks the way you want it to
- Make sure that all of the fields on your form template (especially the ones field linking to the Case object) are showing up on the form. If the form is missing some questions, it means that your Public Site Guest User does not have the proper object-level permissions to see these fields. Revisit the Setting up a Salesforce Public Site article and fine-tune the object level settings of your Public Site Guest User
- Once you fill out the form, double check that it's actually creating a case in Salesforce.
Step 4: Matching Your Case with an Existing Contact and Account
Salesforce's standard Web-2-Case functionality will sometimes match new cases up with existing contacts / accounts in the system, based on email address. Because we're not using standard Web-2-Case, our cases won't automatically tie that information together. However, that doesn't mean that we can't. With a little bit of declarative system automation, we can make sure that every new case submitted with a Youreka form is properly associated with a Contact and Account in Salesforce (so long as there is a match!).
In this example, we've created a Process Builder and Flow to make this type of automation happen. The Process Builder fires when a new Case is created. The Case must not have a Contact or Account associated with it, and it must have an email address in the Web Email field. If this criteria is met, we launch a Flow that is set up to receive two variables - CaseId and Email Address
In the flow, we're using the email address from the case and searching the Contact object for any record that has a matching email address. If we find one, we update the case with the AccountID and ContactID from the Contact record that matched.
When it's all said and done, the end result looks something like this: