Fetch Month/Year via Email Scripting | Community
Skip to main content
Jun 6, 2016 10:34 AM UTC
Solved

Fetch Month/Year via Email Scripting

Hello Everyone,

I have an email which is to be sent periodically, I was wondering if there is a way to automatically fetch the current month/last month/current year. Much like a token would do. I tried to google it but I could only find it could be done using Email Scripting Token.

My email line reads like this:

"Please submit any pending reports for upload for the month of <Last Month>. The last date for submission is 10th, <Current Month> <Current Year>."

Is there any way it can fetch the information automatically.

Thank you in advance.

Harshit

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Nicholas_Manojl
Nicholas_ManojlAccepted solution
Level 8
Jun 7, 2016 6:55 AM UTC

Hi Harshit,

#set($calendar = $date.getCalendar())  

$calendar.add(2,-1) 

$date.format('MMMM',$calendar)

(come back and mark me as correct if this works for you).

#set($calendar = $date.getCalendar())   //get a calendar

$calendar.add(2,-1)  //use the calendar add tool, init month (2) and -1

$date.format('MMMM',$calendar)  //display the date in the format MMMM

13 replies

Level 1
Aug 21, 2020 5:26 PM UTC

When i'm trying to use the token {{system.dateYear}} in the email, it shows Token key not found error. Do i need to do any extra step to enable this token in the instance?

Translate
SanfordWhiteman
Level 10
Aug 21, 2020 6:44 PM UTC

I don't think the token actually exists. You still need to use the standard method (Velocity in emails, JS on pages).

Translate
JimmySpencer_
Level 2
Aug 21, 2020 7:05 PM UTC

Hey @sanfordwhiteman Just signed up for your updates. Was looking through the blog. Any plans to add a search feature?? Great stuff, thank you!

Translate
--Just a guy who knows enough to get into trouble--
Ravi_Ansal2
Level 5
Jun 7, 2016 5:27 AM UTC

Hi Harshit Pandey​,

You can find it on the developer website. Find the link below:

http://developers.marketo.com/documentation/velocity-script/

Hope this helps.

Translate
Jun 7, 2016 5:48 AM UTC

Hey Ravi,

Thank you for your prompt response, however I do not have any exposure to scripting and such so I was wondering if anyone could help me with the script itself so I could place it in custom token. Any help will be much appreciated.

Thank you for your time.

Translate
pavel_plachky
Level 5
Jun 6, 2016 11:33 AM UTC

Hello Harshit,

The easiest way to do this is through the Velocity email scripting. There is no Marketo UI for this functionality.

Best,

Pavel

Translate
Jun 7, 2016 4:34 AM UTC

Hello Pavel,

The velocity email scripting link is not accessible from the Marketo doc, is there any other document or link which could guide?

Thanks,

Harshit

Translate