I have a workflow where I take an HS date field (deal created date) and set it to a new date variable using custom code. Only passing the date variable through the custom code results in setting ‘Invalid date’.The actual use case is more complex than just passing data through custom code: getting the minimum of multiple dates with specific fallbacks and rules. So, I need the custom code but I can’t get the simple version to work. Attempts so far:
- Set to deal create date: success
- Set to custom code output: Invalid date
- Set to format of custom code output: Invalid date
Please advise
Custom code:
def main(event):
try:
# Retrieve all relevant fields (do not alter the dates)
created_date = event[“inputFields”].get(“createdate”, None)
# Return output fields without altering the date values
return {
“outputFields”: {
“created_date”: created_date
}
}
except Exception as error:
# Handle unexpected errors
return {
“outputFields”: {
“created_date”: None,
“error”: str(error),
}
}




