If any of my blogs or videos have ever helped you, I’d love to ask a favour.
I’m taking on a challenge: walking 50 KM in under 10 hours in honour of two incredible women who are both bravely facing chemotherapy right now.
🩷 I’m fundraising for Cancer Research UK 🩷
If you can help, every donation, big or small, helps bring us closer to a cure
D365 Marketing Weekly
Have you seen the D365 Marketing Weekly newsletter yet?
A weekly issue covering features, functionality and news on the topic of Marketing, specifically covering Dynamics 365 Marketing and other interesting tools and tips for anyone interested in the subject.
Subscribe Here
*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***

I’ve written about creating an add to Google calendar link previously, but that was using Power Automate, and it was done to add a link to a meeting using Microsoft Bookings. So similar, but definitely not the same as doing it for your Session or Event Registrations in Realtime. This post is also similar to creating an add to outlook link for your Session or Event Registrations, but this time for a Google Calendar. AND even better, you won’t need to have access to or know Power Automate to do it. You will need to create a new formula field, but all the info you need is in this post, so let’s get started!

We are going to end up with a custom formula field. If you want a bit of an overview of formula fields because you’ve never used them before, check out one of my other blogs here. The structure begins with a base URL. We can then pass through a series of parameters in to the URL to set the text for the Subject, Location (Microsoft Teams), Start Date/Time, End Date/Time, time zone, and the details of the appointment including a unique link to join the webinar in Microsoft Teams. Before creating the new field, we need to do something to get the Start/End date and time in an ISO 8601 basic format combined date and time string in UTC. It will need to be a text string rather than a date, so we need to do some formulas on the session (or event) to set the UTC values correctly. If we don’t and just try and use the out of the box start/end time in UTC format field, we will get errors due to time zone issues. Add two new fields, ISO Start Date and ISO End Date. Again, either add to the Event table or the Session table (or both if you have both Events and Sessions). Pick the field type of Formula for each.

Click to view in detail

This is the formula for ISO Start Date.

If(
    !IsBlank('Start time UTC format'),
    Text(Year('Start time UTC format'), "0") &
    Text(Month('Start time UTC format'), "00") &
    Text(Day('Start time UTC format'), "00") &
    "T" &
    Text(Hour('Start time UTC format'), "00") &
    Text(Minute('Start time UTC format'), "00") &
    Text(Second('Start time UTC format'), "00") &
    "Z",
    Blank()
)

This is the formula for ISO End Date.

If(
    !IsBlank('End time UTC format'),
    Text(Year('End time UTC format'), "0") &
    Text(Month('End time UTC format'), "00") &
    Text(Day('End time UTC format'), "00") &
    "T" &
    Text(Hour('End time UTC format'), "00") &
    Text(Minute('End time UTC format'), "00") &
    Text(Second('End time UTC format'), "00") &
    "Z",
    Blank()
)

Once you have those added, you can go to the Session Registration table (or Event Registration table) and add a new formula field. It will end up being a single line of text, but you can set the format to be a URL.

Click to view in detail

This is the formula you need. If you named the two new date and time fields the same as me, this should work for you. If you are doing this on the Event Registrations, just change where you see the word Session to the word Event and it should work.

"https://calendar.google.com/calendar/event?action=TEMPLATE"
& "&text=" & Session.'Session title'
& "&location=Microsoft%20Teams"
& "&dates=" & Session.'ISO Start Date'& "%2F" & Session.'ISO End Date'
& "&ctz=Europe/London"
& "&details="
& "Hi%20" & Contact.'First name (firstname)'
& "%3Cbr%3E%3Cbr%3E"
& "Look%20forward%20to%20seeing%20you%20online!"
& "%3Cbr%3E%3Cbr%3E"
&
If(
    IsBlank(Session.'Teams URL'),
    "",
    "Join%20session%3A%20%3Ca%20href%3D%22"
    &
    Substitute(
        Substitute(
            Left('Event registration ID'.'QR code', 103)
            & "checkin/stream?eventRegistrationId=&sessionRegistrationId="
            &  Substitute('Registration ID'," ","+")
            & "&redirectUri="
            & Session.'Teams URL',
        "%", "%25"),
    "&", "%26")
    & "%22%3EMicrosoft%20Teams%20Session%3C%2Fa%3E"
)

Now we can break it down to see what each part means. First we need a base URL which contains the Google Calendar endpoint for creating a new event. Passing the parameter of action=TEMPLATE tells Google to open the new event screen pre-filled with the next values that we pass in.

https://calendar.google.com/calendar/event?action=TEMPLATE

Next we add in the title of the Session (or Event). The value is being pulled in this case from the related Session on the Session Registration record and is the title of the Session that was registered for.

&text=Session.'Session title'

Google then expects a Location next. ‘location=’ sets the event location and then Microsoft%20Teams.
%20 is URL encoding for a space so the location will display on the calendar event as Microsoft Teams.

&location=Microsoft%20Teams

Next the dates parameter needs the start and end date using the new ISO fields from the Session that we created above. The two must be formatted together which would create something like this: 20260520T090000Z%2F20260520T100000Z

&dates=Session.'ISO Start Date'%2FSession.'ISO End Date'

The next part is probably the most challenging part. ctz= means calendar time zone. Then you need to pass through the Event time zone in a specific format to ensures Google interprets the time correctly for everyone. The challenge is that the time zone on the event is not in the format Google needs it, which is something called IANA Time Zone Database format. It follows the pattern of Area/Location. So Europe/London or America/Chicago, Australia/Sydney etc. For me, all of the Events are Europe/London so it’s fine. If you do them in different time zones and can’t hard code it, you would need to set up a custom field on your Event to add in the options for the different time zones you use.

&ctz=Europe/London

The last part is the details which we use to pass through some text and a Microsoft Teams link to the Session which will become the body of the calendar description.

&details=

We have the first line that takes the First name of the Contact registered for the session, then pass through a space using %20.

Hi%20Contact.'First name (firstname)'

Then we have two line breaks.

%3Cbr%3E%3Cbr%3E

Then if the Session Microsoft Teams URL isn’t blank, it creates a fully encoded URL with a hyper link included. For more information on the specifics of building the link, check out this awesome post from Amey Holden where she generated a direct Join In Teams link.

If(
    IsBlank(Session.'Teams URL'),
    "",
    "Join%20session%3A%20%3Ca%20href%3D%22"
    &
    Substitute(
        Substitute(
            Left('Event registration ID'.'QR code', 103)
            & "checkin/stream?eventRegistrationId=&sessionRegistrationId="
            &  Substitute('Registration ID'," ","+")
            & "&redirectUri="
            & Session.'Teams URL',
        "%", "%25"),
    "&", "%26")
    & "%22%3EMicrosoft%20Teams%20Session%3C%2Fa%3E"
)

Once you’ve added the formula, you should be able to save it (wait a moment if you don’t see the Save button), then add it to your Session Registration (or Event Registration) form so you can see it. You are now able to include it in an Email. I have a custom Session Registration trigger, which ideally you also have if you are sending out emails specific to Session Registrations. You can also access Session information via out of the box triggers using Lists. Here you can see I am adding my new field dynamically which I am putting on a button. There is a feature that allows you to prevent HTML encoding. Make sure you select this to turn it on. That means it doesn’t try and change the information and encoding things within the value our formula has set. We don’t want the email trying to change anything!

Click to view in detail

Again, we do not want the email messing with our link and trying to add in additional parameters, so make sure on your button or wherever you are adding this link, you scroll to the bottom, expand tracking, and untick the tracking box that is always on by default. You won’t know who has clicked on it, but I think having this option is worth it, and we just have to sacrifice stats on that specific button link.

Click to view in detail

When the email is sent and the full URL is clicked from the button in the email, it opens Google Calendar, then pre-fills the title, location, start and end time, time zone, description with a greeting and a clickable Microsoft Teams session link.

Click to view in detail

Unsure about your Customer Insights set up?

Customer journeys are powerful, but only if the platform, data model, and compliance framework are aligned.

I work with teams using Customer Insights Journeys to make sure it is set up correctly, data is compliant, and journeys deliver without surprises.


D365 Marketing Weekly
Have you seen the D365 Marketing Weekly newsletter yet?
A weekly issue covering features, functionality and news on the topic of Marketing, specifically covering Dynamics 365 Marketing and other interesting tools and tips for anyone interested in the subject.
Subscribe Here

If any of my blogs or videos have ever helped you, I’d love to ask a favour.
I’m taking on a challenge: walking 50 KM in under 10 hours in honour of two incredible women who are both bravely facing chemotherapy right now.
🩷 I’m fundraising for Cancer Research UK 🩷
If you can help, every donation, big or small, helps bring us closer to a cure
This is just 1 of 587 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.


Leave a Reply

Your email address will not be published. Required fields are marked *