Change data value flowstep to update values to datetime field | Community
Skip to main content
New Participant
December 6, 2023
Solved

Change data value flowstep to update values to datetime field

  • December 6, 2023
  • 1 reply
  • 1705 views

Hello,

I'm trying to change the value of a field coming from an integration and appended via Custom Object and I wanted to turn it into a date field, as I would need to use the on or before/on or after criteria - but it's currently with the following format: YEAR/DAY_MONTH (example: 2023/01_08).

 

To do so, I thought to create a triggered smart campaign with a data change flow step that would call a velocity script token to change the format to ISO, and then add it to a custom field. The issue I'm encountering is that the custom field, to have a tokenized value, needs to be a string, so the script gets added as a value rather than a date format.

 

This is the script I'm currently using:

#set( $myDate = "${testCO_cList.get(0).entry_Term_ID}" ) ## Replace this with your actual date variable #if( $myDate && $myDate.length() > 0 ) #set( $parts = $myDate.split("/") ) #set( $year = $parts[0] ) #set( $dayMonth = $parts[1] ) #if( $dayMonth.contains("_") ) #set( $dayMonthParts = $dayMonth.split("_") ) #set( $day = $dayMonthParts[0] ) #set( $month = $dayMonthParts[1] ) #set( $isoDate = "${year}-${month}-${day}T00:00:00.000Z" ) ISO Date: $isoDate #else Invalid Day/Month Format #end #elseNo Date Available #end

Not sure this is the correct way to go about it, any suggestions are welcome 🙂

 

Thanks,

Livia

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Michael_Florin-2

Hello Livia,

 

you can't use Velocity to update a field. It's called "Email Script Token" as it can only render its output on emails.

 

For your case, I think you will have to use an outside service. Send your field through a webhook to - e.g. - https://flowboo.st/ and have it transformed there, then write it back via the response.

1 reply

Michael_Florin-2
Michael_Florin-2Accepted solution
New Participant
December 6, 2023

Hello Livia,

 

you can't use Velocity to update a field. It's called "Email Script Token" as it can only render its output on emails.

 

For your case, I think you will have to use an outside service. Send your field through a webhook to - e.g. - https://flowboo.st/ and have it transformed there, then write it back via the response.

LiviaTAuthor
New Participant
December 6, 2023

Ok thanks, another solution was to change the format before it entered Marketo. I will take a look at the webhook, thanks for your help 🙂