Introducing Agical.io, the smarter ICS file generator | Community
Skip to main content
SanfordWhiteman
New Participant
August 3, 2016
Question

Introducing Agical.io, the smarter ICS file generator

  • August 3, 2016
  • 13 replies
  • 13341 views

If you've used Marketo's dynamic ICS files (the "Calendar File" token type) you're probably not completely happy with 'em.

About a year ago, I published a (free) microservice that fills in the biggest gaps. With a little more attention on it lately (read: 2 people cared!), I blogged about it.

Read more on TEKNKL :: Blog →

13 replies

May 13, 2017

Great stuff, thanks Sanford. I think this is exactly what I am looking for.

January 3, 2017

Hey Sanford,

I hope you're doing well. I'm trying to use the Agical.io ICS file generator you built and am running into an issue that I hope you can help me resolve. Thank you for creating this tool and offering it to the Marketo community.

I have two velocity scripting based tokens for the event start date and end date that are record specific and need to be in the URL for the ICS file. When I try to reference those tokens as values in a URL an extra space is added, causing the hyperlink to fail when clicked. By fail, I mean that the event start time and end time reders as a static value: 12/31/1969 4:00 PM. I believe this is due to the URL being rewritten by Marketo for tracking purposes. If you copy and paste the non-rewritten URL in a browser, the link works just fine.

Rewritten/tracked URL: em.sungevity.com/dc/s4ZLka5FfdFC9m1cmI_hrfzCmWMofwKTi4SUWBNAIw3LVZb3cBJV4iftjWnumggM45sqe1n3FwjsAI39bP3VjsLB2At9G…

Copied and pasted URL with populated custom tokens: http://ics.agical.io/?subject=Sungevity%20Home%20Visit&organizer=Sungevity&reminder=45&location=1205 Foster Ter&dtstart= 2017-01-04T23:00:00Z&dtend= 2017-01-04T20:00:00Z

See the spaces below. The issues looks specific to the token being included in a URL as the first two bullets are just non-linked token values. The rest are hyperlinks and are problematic. Please let me know if you have any ideas to resolve this issue. Thanks very much!

Daniel

SanfordWhiteman
New Participant
January 4, 2017

Are you positive there isn't whitespace being output from your script?  Remember, Velocity preserves whitespace like line breaks, because the output context may require it (think text part of an email as opposed to HTML part).

January 4, 2017

Thanks for your quick reply. That's great to know. I've removed all visible line breaks and spaces, but the link still populates with spaces. Do you have any other ideas for what could be causing the issue?

Here's script for the first token that's referenced as the dtstart parameter.

##Start of Script

## first want to grab the value of the home visit date time and convert it into format we want

## BASED ON SFDC CONFIG, ASSUMING THIS VALUE IS IN PST plus 2 hours

## used parseDate (string value, string format) within velocity

#set($dateObj = $convert.parseDate($Milestone1_Project__cList.get(0).Home_Visit_Date__c, 'yyyy-MM-dd HH:mm'))

## then we convert to a calendar object

#set($calendarObj = $convert.toCalendar($dateObj))

## comparing Time Zone on the Project and the to localize appointment time

#if ($Milestone1_Project__cList.get(0).Time_Zone__c == "EST" && $Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

## 10 represents 'hour' in calendar object?

## add 7 hours + 8 hours as it's translated into Greenwich in the final output.

$calendarObj.add(10,24)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "CST" && $Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,23)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "MST" && $Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,22)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "PST" && $Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,21)

## comparing Time Zone and value in Home Visit Date field to update all records that don't have an appointment at 12:00pm

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "EST" && !$Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,12)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "CST" && !$Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,11)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "MST" && !$Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,10)

#elseif ($Milestone1_Project__cList.get(0).Time_Zone__c == "PST" && !$Milestone1_Project__cList.get(0).Home_Visit_Date__c.contains("12:00:00"))

$calendarObj.add(10,9)

#end

$date.format('yyyy-MM-dd',$calendarObj)T$date.format('HH:mm:ss',$calendarObj)Z

August 3, 2016

Thanks sanford!