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

You’ll also learn see a script with conditions where you can update the value of a custom field after comparing 2 values.

Important: DT.setField function cannot be used on the last node for V2 DTs.

The syntax looks like this:


/* 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);


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.

How to Update a Custom Field After Doing a Comparison of 2 Values

Please see this video for more…

Click this Link to Grab: Sample Decision Tree:

  	DT.setField('1st_lower_value', "{1st_mortgage}"); 
  	DT.setField('1st_lower_value', "{1st_mortgage2}");