Update: The post below explains some problems I experienced that seem to have been a fluke or perhaps based on some temporary problem with the APIs. As of now I can simply log in and dont see anything like the error behavoir I explain below. Ultimately the primary resolution to the problem I had seemed to be waiting as the problem seems to have gone away by itself, also huge thanks to Alice for pointing out the 'see more' option in the dynamic input which allows dynamic insertion of plaintext email value into mail field.
Yesterday I created a flow that included sending an email, and I needed to get the user profile from graph so used the O365 get user profile (v2), I also tested the get my profile (v2), and both of these functions are problematic, with version 1 of these functions, you could simply get the profile and then use a send email connector and simply populate the email address from the get profile into the send email address. But v2 version of these functions after you get the user profile, the dynamic content window will not allow you to insert the profiles mail field into the send to field on the send email block.
It will allow you to insert any field from the get profile connector into a text field like, for example you can insert the fields from the get profile into the body field of a send an email connector, but when you insert the field from get profile, it will wrap any connector you insert a field into in a "Apply to each" block. Even though a get my profile or get user profile action should return a single profile, the connector just assumes that the get profile action could output an array and automatically wraps any use of the profile data into these "apply to each" blocks, even though this shouldnt be the case with a single response query like get profile.
As a workaround I insert an expression to grab the field you want from the user profile and insert it into the destination field in the destination connector. If you insert any dynamic content fields in any flow, and then hover over the field you inserted, you can see the expression used by flow to connect the data, it should look something like: body('GetUserProfile')?['Mail']
In the above expression, GetUserProfile is the name of the connector that provides the data source, I grabbed a 'get user profile (v2) connector, and renamed it without spaces to GetUserProfile to make it easier to reference. In any case in the above expression, you would place the name of your data source connector where it says GetUserProfile, and then in place of Mail, you would use the name of the field you want to include, if you are using the get profile v2 connectors, Mail is the name of the email field in the Graphv1 user profile.
Hi @ afewell,
Could you please share a screenshot of the configuration of your flow?
For your first question:
Do you mean you couldn't choose the "Mail" dynamic content of the "Get user profile" in the "To" field of the "Send an email" action?
I have made a test on my side and don't have the issue that you mentioned, please refer to screenshot below:
Please check if you have click the "See more" of the "Get user profile" action, if you click the "See more" of the "Get user profile" action, you could see all of the dynamic content of the "Get user profile" action.
For your second question:
Do you mean when you insert the field from get profile, it will wrap any connector you insert a field into in a "Apply to each" block?
Whicn value have you insert to a field?
Does the value is a Array type value?
Please check if the value is a Array type value, if the value is a Array type value, the flow would add a "Apply to each" automatically when you insert the value to a field.
Thank you for your response,I cant explain why but I just went to replicate the problems I have been seeing over the past 2 days and they seem to have gone away and it looks like things are working now.
The first problem I had is resolved by using the 'see more' which allows me to populate the email fields. Ive never had to use the see more option and unsure why the variables are hidden when I try to populate an email field, but happy that the see more option works!
The other one which I cant understand is, yesterday if I were to take any output field from the get user profile v2 and put it in say the detail field of an approval function or the body of a send email function, it would automatically wrap the function in a apply to each block even though get user profile should output a single record. I started trying this on a template from a previous flow, and then also tried it on a brand new from blank flow and had the same results over ~20 tests. I simply added the action and changed no settings for the get user profile (v2) and did not implement any filters. Flow clearly thought the get user profile v2 was an array in my tests yesterday and I cant fathom why, but in any case its working today.
There may have been another unrelated issue happening with the graph API yesterday. I was able to get everything working using the workaround described above for a few tests, I input my UPN by populating the Get User Profile v2 UPN input value with the plaintext field where I store my UPN in sharepoint. I ran several tests without changing this value, at first get user profile was working fine, and then it started producing errors that it couldnt resolve my UPN. I even tried manually typing in my UPN in the input and still got the same errors. Looking at my flow run records I can see the runs that worked and then the ones that started failing just seconds after with no changes, here is one the error I was getting:
Unable to process template language expressions in action 'GetAttendeeProfile' inputs at line '1' and column '1838': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_office365users']['connectionId']' cannot be evaluated because property 'shared_office365users' doesn't exist, available properties are 'shared_sharepointonline, shared_approvals, shared_office365'. Please see https://aka.ms/logicexpressions for usage details.'.
Fortunately everything seems to be working for me today just like what you experience, thanks for your help!
Fill out a quick form to claim your user group badge now!
We've given our badges an overhaul and also added some brand new ones!
Learn how to build the business apps that you need.
Find out where you can attend!
Watch & learn from the Power Automate Community Video Gallery!