Power Automate Add Participant to an event

I am trying to add a participant to an event when someone submits a form. At the beginning of the flow, I search the constituent and if they are in RE then I want to add the event. How do I grab the constituent record from the search? I can successfully add a participant record if I manually add in the constituent record, but I can't seem to grab it from the search.

Comments

  • Hi Rachel,


    The Search for a constituent connector action returns a list of results (it's an array of objects), and you can reference the ID of the constituent via the Dynamic Content window (you'll see it labeled as "ID" below). Note that this value is the "system record ID" not the user-defined Lookup ID, which is good because that's the value expected by the Create a participant action!.


    Since the search returns a list of matches, you'll probably want to express what should happen if no results (or multiple results) are found. In my example below, I'm only taking an action (creating a participant) if a single result was returned by the search action (meaning, the Count property of the response is 1):





    Note that Power Automate will automatically inject an "Apply to Each" block when you reference the ID because it won't know you're only doing this work for a single item:

    .


    So it's essentially a loop over a single record, which works fine just makes the flow a bit more awkward to read. If you'd rather not see the Apply to Each block, you can use a Compose action with an expression to grab the ID of the first item in the search results:





    In the above example, the expression I'm using with the Compose action is:

    first(outputs('Search_for_a_constituent')?['body/value'])['id']

    That expression takes the first item of the value property of the search result action, and then returns the id property.


    I hope this helps - let us know if you have any questions!

Categories