Quantcast

Eloqua Forms: Concatenating custom questions to pass over to CRM

Aug 19, 2023

A problem I have come across frequently is that marketing departments like to add a number of bespoke questions to different lead generating forms which are obviously valid however neither the Eloqua database, nor their CRM platform has these fields in it.

Greg Staunton

So…  How do you get these questions sent over to the CRM.  Eloqua CDOs you say?  Close but no cigar.  You can set the responses given on an Eloqua CDO but how are you going to get them in the CRM so sales can make use of them?

The diagram shows you (poorly formatted) Eloqua form on the left, these are the custom fields, obviously you would have the normal Eloqua fields like email address, etc on it too.  On the right you have the lead object in SFDC (or whichever CRM you are using) showing up in the Lead Notes field.  The rest of this Eloqua forms tutorial will show you exactly how to do this.  REMEMBER – the Lead Notes field in Eloqua must be integrated with your Lead Notes field in SFDC (or your CRM).

Eloqua Form
Eloqua Form

Scenario

In this scenario you have been asked to add in several questions to a form (these are the HTML values for you devs that are reading this) and have this information sent to your CRM platform so sales can utilize the information provided using lead notes.  Lead notes is both an area text field in Eloqua and your CRM so you will not have any problems with character limits.

These are the actual fields (Also I know this works, I used this exact code to solve this problem for a client):

  • customMarket
  • customInHouseFPGA
  • projectSize
  • customPrototype
  • customStartdate
  • customLifetime
  • customTargetcost
  • customExpectedVolume

Solution

Step 1: Create a new JavaScript function called “concatenateFields” that will be triggered when the form is submitted. Add this code inside a <script> tag in the <head> section of your HTML file:

<script>
function concatenateFields() {
// code to concatenate input field values and populate the hidden field
}
</script>

Step 2: In the same <head> section of your HTML file, add a reference to the JavaScript file that contains the concatenateFields function. For example, if your JavaScript file is called “script.js” and it’s located in the same folder as your HTML file, you can use this code:

<script src=”script.js”></script>

Step 3: Create the HTML form that contains the input fields and the hidden field. Here’s an example form (remember to add in your normal Eloqua form processing HTML!):

<form onsubmit=”return concatenateFields();”>

<label for=”customMarket”>Custom Market:</label><input type=”text” id=”customMarket” name=”customMarket”><br>

<label for=”customInHouseFPGA”>Custom In-House FPGA:</label>

<input type=”text” id=”customInHouseFPGA” name=”customInHouseFPGA”><br>

<label for=”projectSize”>Project Size:</label>

<input type=”text” id=”projectSize” name=”projectSize”><br>

<label for=”customPrototype”>Custom Prototype:</label>

<input type=”text” id=”customPrototype” name=”customPrototype”><br>

<label for=”customStartdate”>Custom Start Date:</label>

<input type=”date” id=”customStartdate” name=”customStartdate”><br>

<label for=”customLifetime”>Custom Lifetime:</label>

<input type=”text” id=”customLifetime” name=”customLifetime”><br>

<label for=”customTargetcost”>Custom Target Cost:</label>

<input type=”text” id=”customTargetcost” name=”customTargetcost”><br>

<label for=”customExpectedVolume”>Custom Expected Volume:</label>

<input type=”text” id=”customExpectedVolume” name=”customExpectedVolume”><br>

<input type=”hidden” id=”leadNotes” name=”leadNotes”>

<input type=”submit” value=”Submit”>

</form>

Note that there’s a hidden input field with the ID “leadNotes” that will be populated with the concatenated values of the other input fields.

 

Step 4: Inside the concatenateFields function, create variables for each of the input fields that you want to concatenate. In this case, the fields are “customMarket”, “customInHouseFPGA”, “projectSize”, “customPrototype”, “customStartdate”, “customLifetime”, “customTargetcost”, and “customExpectedVolume”. Here’s the code:

<script>

function concatenateFields() {

var customMarketValue = document.getElementById(‘customMarket’).value;

var customInHouseFPGAValue = document.getElementById(‘customInHouseFPGA’).value;

var projectSizeValue = document.getElementById(‘projectSize’).value;

var customPrototypeValue = document.getElementById(‘customPrototype’).value;

var customStartdateValue = document.getElementById(‘customStartdate’).value;

var customLifetimeValue = document.getElementById(‘customLifetime’).value;

var customTargetcostValue = document.getElementById(‘customTargetcost’).value;

var customExpectedVolumeValue = document.getElementById(‘customExpectedVolume’).value;

}

</script>

Step 5: Concatenate the input field values into a single string using the + operator. You can add separators like spaces or commas to make the concatenated string more readable. Here’s an example code that concatenates the values with a space between them:

<script>

function concatenateFields() {

var customMarketValue = document.getElementById(‘customMarket’).value;

var customInHouseFPGAValue = document.getElementById(‘customInHouseFPGA’).value;

var projectSizeValue = document.getElementById(‘projectSize’).value;

var customPrototypeValue = document.getElementById(‘customPrototype’).value;

var customStartdateValue = document.getElementById(‘customStartdate’).value;

var customLifetimeValue = document.getElementById(‘customLifetime’).value;

var customTargetcostValue = document.getElementById(‘customTargetcost’).value;

var customExpectedVolumeValue = document.getElementById(‘customExpectedVolume’).value;

 

var concatenatedString = customMarketValue + ‘ ‘ + customInHouseFPGAValue + ‘ ‘ + projectSizeValue + ‘ ‘ + customPrototypeValue + ‘ ‘ + customStartdateValue + ‘ ‘ + customLifetimeValue + ‘ ‘ + customTargetcostValue + ‘ ‘ + customExpectedVolumeValue;

 

}

</script>

Step 6: Populate the value of the hidden input field with the concatenated string. You can use the document.getElementById function to select the hidden field and the value property to set its value. Here’s the complete code:

<script>

function concatenateFields() {

var customMarketValue = document.getElementById(‘customMarket’).value;

var customInHouseFPGAValue = document.getElementById(‘customInHouseFPGA’).value;

var projectSizeValue = document.getElementById(‘projectSize’).value;

var customPrototypeValue = document.getElementById(‘customPrototype’).value;

var customStartdateValue = document.getElementById(‘customStartdate’).value;

var customLifetimeValue = document.getElementById(‘customLifetime’).value;

var customTargetcostValue = document.getElementById(‘customTargetcost’).value;

var customExpectedVolumeValue = document.getElementById(‘customExpectedVolume’).value;

 

var concatenatedString = customMarketValue + ‘ ‘ + customInHouseFPGAValue + ‘ ‘ + projectSizeValue + ‘ ‘ + customPrototypeValue + ‘ ‘ + customStartdateValue + ‘ ‘ + customLifetimeValue + ‘ ‘ + customTargetcostValue + ‘ ‘ + customExpectedVolumeValue;

 

document.getElementById(‘leadNotes’).value = concatenatedString;

}

</script>

Step 7: Test the form by filling in the input fields and submitting the form. The hidden field with the ID “leadNotes” should be populated with the concatenated values of the input fields.

That’s it! You now have a JavaScript function that concatenates the values of multiple input fields and populates a hidden field with the concatenated string.

Here is all the code sitting together for you to use now that you know the process.

<html>

<form>

<label for=”customMarket”>Custom Market:</label>

<input type=”text” id=”customMarket” name=”customMarket”><br><br>

<label for=”customInHouseFPGA”>Custom In-House FPGA:</label>

<input type=”text” id=”customInHouseFPGA” name=”customInHouseFPGA”><br><br>

<label for=”projectSize”>Project Size:</label>

<input type=”text” id=”projectSize” name=”projectSize”><br><br>

<label for=”customPrototype”>Custom Prototype:</label>

<input type=”text” id=”customPrototype” name=”customPrototype”><br><br>

<label for=”customStartdate”>Custom Start Date:</label>

<input type=”text” id=”customStartdate” name=”customStartdate”><br><br>

<label for=”customLifetime”>Custom Lifetime:</label>

<input type=”text” id=”customLifetime” name=”customLifetime”><br><br>

<label for=”customTargetcost”>Custom Target Cost:</label>

<input type=”text” id=”customTargetcost” name=”customTargetcost”><br><br>

<label for=”customExpectedVolume”>Custom Expected Volume:</label>

<input type=”text” id=”customExpectedVolume” name=”customExpectedVolume”><br><br>

<input type=”hidden” id=”leadNotes” name=”leadNotes”>

<input type=”button” value=”Submit” onclick=”concatenateFields()”>

</form>

<script>

function concatenateFields() {

var customMarketValue = document.getElementById(‘customMarket’).value;

var customInHouseFPGAValue = document.getElementById(‘customInHouseFPGA’).value;

var projectSizeValue = document.getElementById(‘projectSize’).value;

var customPrototypeValue = document.getElementById(‘customPrototype’).value;

var customStartdateValue = document.getElementById(‘customStartdate’).value;

var customLifetimeValue = document.getElementById(‘customLifetime’).value;

var customTargetcostValue = document.getElementById(‘customTargetcost’).value;

var customExpectedVolumeValue = document.getElementById(‘customExpectedVolume’).value;

 

var concatenatedString = customMarketValue + ‘ ‘ + customInHouseFPGAValue + ‘ ‘ + projectSizeValue + ‘ ‘ + customPrototypeValue + ‘ ‘ + customStartdateValue + ‘ ‘ + customLifetimeValue + ‘ ‘ + customTargetcostValue + ‘ ‘ + customExpectedVolumeValue;

 

document.getElementById(‘leadNotes’).value = concatenatedString;

// Optional: Submit the form automatically after concatenating the fields

// document.forms[0].submit();

}

</script>

</html>

 

This code includes all the necessary input fields, the hidden field for the concatenated string, and the JavaScript function to concatenate the input fields and set the value of the hidden field. You can also see a “Submit” button at the end of the form that triggers the concatenateFields() function when clicked.

What is Eloqua?

What is Eloqua?

Eloqua is a cloud-based marketing automation platform that helps businesses automate their marketing processes and deliver personalized experiences to their customers. The platform is designed to streamline marketing efforts, improve efficiency, and increase revenue...

Part 5. Eloqua Master Exclude

Part 5. Eloqua Master Exclude

There will be times that you do not want email to get sent to contacts for a multitude of reasons.  This guide will teach you how to set these up, what they means and how to update your Eloqua Architecture Document.  If you have not already done, please read Part 1....

Part 4. Eloqua User Access Levels

Part 4. Eloqua User Access Levels

One of the first considerations you will need, is what different levels of Eloqua user access do you want users to have?  If everyone can do anything they want you are going to have some serious problems, fast. If you have not already done, please start from the...

error: Content is protected !!