Skip to main content

Environment variables are supported for many actions like SharePoint Online, Dataverse and so on.

It can happen that sometimes you cannot select the environment variable in your flow, which gives the impression that you cannot use environment variables there.

A good example of such a trigger is the “When a new email arrives in a shared mailbox (V2)” trigger. You cannot add dynamic content in the “Orginal Mailbox Address” field using the UI.

This can be solved. Make sure that you create an environment variable to store the shared mailbox email address. It can be of data type “Text”.

Open your flow, add a “Compose” action and add the environment variable to it.

Copy the “Compose” content into the shared mailbox action.

You will see that the @parameter expression will appear.

It’s not finished yet. Click “Peek code”.

You will see that two “@” characters appear. This is not what we want as this will lead to the flow not recognizing the environment variables. Only with one “@” character, the parameter expression will be recognized.

The trick here is to put a space in front of your expression.

Click “Peek code” again and you’ll notice that the second “@” character is gone.

Don’t forget to save your flow. After refreshing the page, you’ll see that the @parameter value has been changed into real dynamic content.

This limitation has been escalated to the Microsoft product group, so I hope that I can soon announce the good news that we can just add dynamic content into the shared mailbox action without doing complex workarounds.

In the meantime, you are unblocked and you can use environment variables within shared mailbox actions.

This logic should be reusable for other actions which don’t support dynamic content yet.

4 Comments

  • John Nephin says:

    Does this still work for you? When I try it the space never gets removed and the trigger never fires.

    • Wouter says:

      Hi John, the space should not be removed, otherwise the environment variable doesn’t work. Let me know if you found a solution.

  • Jake says:

    Hi,

    I’ve been fighting this for a while and just got it working. The detail can be seeing when comparing these two lines:

    ” @parameters(‘Enquiries To Log Email (sk_EnquiriesToLogEmail)’)”
    ” @{parameters(‘Enquiries To Log Email (sk_EnquiriesToLogEmail)’)};”

    The second has the curly brace and a semi-colon at the end. At very least the brace are needed, not sure about the semi-colon but its working so I’m going to leave it.

    I was trying to get the param reference from a “peek code” of another action that was using the Environmental Variable. I believe this is why I didn’t get the brace as that is something compose does.

    I hope this helps someone.

    Thanks

    Jake

Leave a Reply