If you use custom scripts, sometimes you will want to pass a scripted variable to a custom field.

The syntax looks like this:

<script>

/* Syntax */
DT.setField('variable_name', 'value');

/* Static value parameter */
DT.setField('first_name', 'Aubrey');

/* Custom field parameter */
DT.setField('first_name', '{custom_field}');

/* Scripted field parameter */
var name = 'Aubrey';
DT.setField('first_name', name);

</script>

Note that the first parameter is the custom field name without the curly brackets. So {full_name} would be written as ‘full_name’.

The second parameter is the value you want to pass to the custom field. This can be static text, another custom field, or a scripted variable.

Here’s an example, where we pass a JavaScript variable to a LeadsHook custom field.

Here’s another example where we append two custom fields and send the result into one custom field.

Leave a Reply

Your email address will not be published. Required fields are marked *