Hi there, this is Erin Oz from the Zapier Support Team with a workflow idea to share.
Have you ever wanted to trigger on a specific calendar event in Google Calendar, but only in cases where a specific person is attending the event?
For example, let’s say you’re an executive assistant, and you want to trigger on all Google Calendar events that the executive has marked “attending”.
Or, let’s say you are working from a shared calendar and only want the Zap to trigger on events you are attending!
You can use a Code Step to search the list of event attendees for your target email address, and add a filter that only allows the Zap to continue if that person has marked “attending”.
Example
I've created a code step solution that will find a specific attendee by email address and return their response.
Start by mapping the Attendees Email and Attendees Response Status fields from Google Calendar as values into keys "attendeesEmails" and "attendeesResponses" as shown below:
Then copy and paste this code into the Code field:
// Create arrays from stringified input data
var attendeesEmailArray = inputData.attendeesEmails.split(','); var attendeesResponsesArray = inputData.attendeesResponses.split(',');
// Find index of erin.ozolins@zapier.com
var targetPosition = attendeesEmailArray.indexOf("erin.ozolins@zapier.com");
// Return corresponding response
var targetResponse = attendeesResponsesArrayntargetPosition] output = #{target_response: targetResponse}];
The expected output will contain the response status for your target attendee:
That way, you can filter on the output field Target Response from the Code Step to only allow the Zap to continue if the status contains "accepted":
Now the following steps in the workflow will run for every event that erin.ozolins@zapier.com is attending!