Introduction:

If you want to split your Decision Tree into available hours of work and unavailable hours, we need to create a custom field, use some JavaScript for the time, and then use this field in a decision node.

Step-by-Step Instructions:

Step 1: Create a number custom field called hour

Step 2: Copy paste this script into any node

<script>
var d = new Date();
var n = d.getHours();

console.log(n);
DT.setField('hour', n);
  
</script>

Step 3: Now you have the current hour saved. So you cant print/display it by surrounding it with curly brackets {hour}

Or you can use it in a decision node.

Note that time is 24 hour format in leadshook.

You can see a working demo here: https://test2.leadshook.io/survey/X5v6dXmbmGOwBoiAHtplUt6rfqDyfPE6eyjE2hTt

Tagged: