This article covers importing the results of a Zingtree session into a form in Salesforce.
With just a little JavaScript magic, you can now add Zingtree data invisibly into your custom “Create Lead” forms.
Here’s what you’ll need to do:
- Create a new custom field in Salesforce. It should be a “Text Area Long” – we like to call it “Zingtree Session Data,” but you can call it whatever you like.
- In your “new case” form, make sure this field is a part of the data entered in the “new case” form.
- Go to Setup, and search for “Web-to-case.” Generate the HTML, and note the id= value of the Zingtree Session Data field in the form.
- At the bottom of the page that contains the form, just above the </body> tag, add this line of code, substituting the id of the form field which will receive the Zingtree data for “######” :
id="zingtree_field_id"
value="######"
src="http://zingtree.com/api/add-session-data-to-form.js">
</script>
- When loading this form from a Zingtree URL Link Node, make sure to add this code to the URL which opens the form:
?session_id=#session#
This setup will load the Zingtree session data into the field you designated for Zingtree data, and then hide the field so it’s not seen by your end-users.
You can see an example page that contains a crude Salesforce form here. When you view the source, you’ll see a text area field with id=”00N61000006Bdlq“, and this code at the bottom of the page:
<script
id="zingtree_field_id"
value="00N61000006Bdlq"
src="http://zingtree.com/api/add-session-data-to-form.js">
</script>