Hi,
I want write Custom Code in workflow. I will be using this code to check if enough time passed to move deal from one stage to another(it should be automatic).
So far everything works fine but i don’t know how to use value from custom property i created(to store date) in my code.
Any tips how to do this?
//const hubspot = require('@hubspot/api-client');
exports.main = async (event, callback) => {
let deal_stage_onboarding___start_time = new Date(); //change to value from deal property
let currentDateDay = new Date().getDate();
let currentDateMonth = (new Date().getMonth()+1);
let output = '';
console.log("Month start: = "+(deal_stage_onboarding___start_time.getMonth()+1)+ ". Month end: = "+currentDateMonth);
if( (deal_stage_onboarding___start_time.getMonth()+4) === currentDateMonth && (deal_stage_onboarding___start_time.getDate()) === currentDateDay) {
console.log("Works");
console.log("Star time: " + deal_stage_onboarding___start_time);
console.log("Current time: Month " + currentDateMonth);
console.log("Current time: Day " + currentDateDay);
output = 'True';
}
else
{
console.log("Not working");
console.log("Start time: " + deal_stage_onboarding___start_time);
console.log("Current time: Month " + currentDateMonth);
console.log("Current time: Day " + currentDateDay);
output = 'False';
}
callback({
outputFields: {
output: output
}
});
}

