Skip to main content
MindTouch Success Center

Create a Salesforce "Submit a Ticket" form

This page applies to:MindTouch (current)

Use a Salesforce web-to-case form in MindTouch that allows your users to send a support request from MindTouch into Salesforce. This will require previous experience with HTML.
 

What will the form look like when I'm done?


Your ticket submission form will look something like this once you perform the steps in this article:



 

How to create the form


Step 1: Obtain the form code

First, build a Web-to-Case form in Salesforce.

  1. In Salesforce, navigate to [your username] > Setup > App Setup > Customize > Self-Service > Web-to-Case HTML Generator

  1. Select the case fields you want users to fill out in your form and be sure to include a custom field where you will store your user's activity token. This field can be a text field of at least 20 characters in length.
  2. Optionally, add a URL where to redirect the user after submission. (We recommend creating a Thank You page.)

  1. Click Generate.
  2. On the following screen, Salesforce will present you with the necessary form code based on your selected fields. Copy this code into a text editor:

Step 2: Add the form to MindTouch

  1. Create a new page in your MindTouch site where you want to store the form. We recommend a path similar to /Submit_Case or /Get_Help.
  2. Edit this page, select a DekiScript block, and paste in your code:

Keep in mind that a DekiScript block must have plain text escaped. As such, you'll need to identify plain text and surround it with double-quotes. See the example code from Salesforce below.

Example code

Unescaped plain text (lines 11–12 and 19–24):

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->
<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type=hidden name="orgid" value="XXX">
<input type=hidden name="retURL" value="http://yourmindtouchsite/ThankYou">
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail" value="jamesv@mindtouch.com">    -->
<!--  ----------------------------------------------------------------------  -->
<label for="name">Contact Name</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br>
<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>
<label for="subject">Subject</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br>
<label for="description">Description</label><textarea name="description"></textarea><br>
usertoken:<input  id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="text" /><br>
<input type="hidden"  id="external" name="external" value="1" /><br>
<input type="submit" name="submit">
</form>


Escaped plain text (lines 11–12 and 19–24), which is now safe to enter into a DekiScript block:

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->
<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="XXX">
<input type="hidden" name="retURL" value="http://yourmindtouchsite/ThankYou">
<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail" value="jamesv@mindtouch.com">    -->
<!--  ----------------------------------------------------------------------  -->
<label for="name">"Contact Name"</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br>
<label for="email">"Email"</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>
<label for="phone">"Phone"</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>
<label for="subject">"Subject"</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br>
<label for="description">"Description"</label><textarea name="description"></textarea><br>
"usertoken:"<input  id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="text" /><br>
<input type="hidden"  id="external" name="external" value="1" /><br>
<input type="submit" name="submit">
</form>
  1. Clean up the HTML to meet all web standards:
  • Ensure the <input> and <br> elements are self-closing
  • Remove HTML comments
  • Remove the <META> element.


Lines 2–3 and 4–11 of the working example below have been updated:

<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="XXX" />
<input type="hidden" name="retURL" value="http://yourmindtouchsite/ThankYou" />

<label for="name">"Contact Name"</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br/>
<label for="email">"Email"</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br/>
<label for="phone">"Phone"</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br/>
<label for="subject">"Subject"</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br/>
<label for="description">"Description"</label><textarea name="description"></textarea><br/>
"usertoken:"<input  id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="text" /><br/>
<input type="hidden"  id="external" name="external" value="1" /><br/>
<input type="submit" name="submit"/>
</form>
  1. Hide the usertoken field from the form:
  • Remove the usertoken text label
  • Add a type attribute with a value of hidden.
     

Below, line 10 has been edited:

<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="XXX" />
<input type="hidden" name="retURL" value="http://yourmindtouchsite/ThankYou" />

<label for="name">"Contact Name"</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br/>
<label for="email">"Email"</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br/>
<label for="phone">"Phone"</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br/>
<label for="subject">"Subject"</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br/>
<label for="description">"Description"</label><textarea name="description"></textarea><br/>
<input id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="hidden" /><br/>
<input type="hidden"  id="external" name="external" value="1" /><br/>
<input type="submit" name="submit"/>
</form>
  1. Add the function to obtain the user's activity token. The code on lines 1–2 should be added to the top of your DekiScript block:
var uriParts = uri.parts(user.activityuri).path;
var CUSTOMERACTIVITYID = uriParts[#uriParts - 1] ?? 0;

<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="XXX" />
<input type="hidden" name="retURL" value="http://yourmindtouchsite/ThankYou" />

<label for="name">"Contact Name"</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br/>
<label for="email">"Email"</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br/>
<label for="phone">"Phone"</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br/>
<label for="subject">"Subject"</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br/>
<label for="description">"Description"</label><textarea name="description"></textarea><br/>
<input id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="hidden" /><br/>
<input type="hidden"  id="external" name="external" value="1" /><br/>
<input type="submit" name="submit"/>
</form>
  1. Update line 13 to pass the user's activity token into the hidden field:
var uriParts = uri.parts(user.activityuri).path;
var CUSTOMERACTIVITYID = uriParts[#uriParts - 1] ?? 0;

<form action="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST">
<input type="hidden" name="orgid" value="XXX" />
<input type="hidden" name="retURL" value="http://yourmindtouchsite/ThankYou" />

<label for="name">"Contact Name"</label><input  id="name" maxlength="80" name="name" size="20" type="text" /><br/>
<label for="email">"Email"</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br/>
<label for="phone">"Phone"</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br/>
<label for="subject">"Subject"</label><input  id="subject" maxlength="80" name="subject" size="20" type="text" /><br/>
<label for="description">"Description"</label><textarea name="description"></textarea><br/>
<input id="CUSTOMFIELDID" maxlength="64" name="CUSTOMFIELDNAME" size="20" type="hidden" value=(CUSTOMERACTIVITYID) /><br/>
<input type="hidden"  id="external" name="external" value="1" /><br/>
<input type="submit" name="submit"/>
</form>
  1. Further customize the form by adding or removing fields that suit your needs.
     
  • Was this article helpful?