cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

Get person email from Get items without apply to each Loop

Hi;

Trying to extract email address from a person in SP list and assign this to a variable. should be easy, but I am stumped. I keep getting the apply to each and I just want to extract email address from the get items without looping. Any help appreciated.

 

Here is my Get Items output:

 

 

{
  "value": [
    {
      "@odata.etag": "\"5\"",
      "ItemInternalId": "2",
      "ID": 2,
      "Title": "title1",
      "ProgramManager": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|name@domian.com",
        "DisplayName": "Fname Lname",
        "Email": "name@domian.com",
        "Picture": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=name@domian.com",
        "Department": null,
        "JobTitle": null
      },
      "ProgramManager#Claims": "i:0#.f|membership|name@domian.com",
      "{Identifier}": "Lists%252fDocapprovalMatrix%252f2_.000",
      "{IsFolder}": false,
      "{Thumbnail}": {
        "Large": null,
        "Medium": null,
        "Small": null
      },
      "{Link}": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/listform.aspx?PageType=4&ListId=076be45b-2e34-4c5e-b969-59e165b62ef1&ID=2&ContentTypeID=0x0100394CAD69C97E764AA4881BA5F296AB71",
      "{Name}": "Title1",
      "{FilenameWithExtension}": "Title1",
      "{Path}": "Lists/DocapprovalMatrix/",
      "{FullPath}": "Lists/DocapprovalMatrix/2_.000",
      "{HasAttachments}": false,
      "{VersionNumber}": "1.0"
    }
  ]
}

 

 

my flow then needs to extract the "ProgramManager" "Email" and set that to a variable.

When I add the set variable, it always inserts the apply to each loop:

Flow1.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Get person email from Get items without apply to each Loop

@jgs000 

 

Get Items - Even though you are getting only one item from this action, the flow always thinks it returns multiple items. Due to that, you will see Apply to each action while setting a variable value from Get Items.

 

To avoid Apply to each, either you Get Item if you know the list item ID. Then, it will not give you Apply to each.

 

In your case, if you think Get Items will always returns one value, then you do not need to worry. I always recommend using Top Count set to 1 in Get Items along with Filter Query with required conditions.

 

Other workaround is to use expression in the Set Variable:

items('Apply_to_each')[0]?['ProgramManager']?['DisplayName']

The above expression gets the Display Name of the Program Manager from the first element of the Get Items.

 

I hope this reply helps you.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

View solution in original post

2 REPLIES 2
Highlighted
Super User II
Super User II

Re: Get person email from Get items without apply to each Loop

@jgs000 

 

Get Items - Even though you are getting only one item from this action, the flow always thinks it returns multiple items. Due to that, you will see Apply to each action while setting a variable value from Get Items.

 

To avoid Apply to each, either you Get Item if you know the list item ID. Then, it will not give you Apply to each.

 

In your case, if you think Get Items will always returns one value, then you do not need to worry. I always recommend using Top Count set to 1 in Get Items along with Filter Query with required conditions.

 

Other workaround is to use expression in the Set Variable:

items('Apply_to_each')[0]?['ProgramManager']?['DisplayName']

The above expression gets the Display Name of the Program Manager from the first element of the Get Items.

 

I hope this reply helps you.

 

Regards

Krishna Rachakonda

If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

 

View solution in original post

Highlighted
Regular Visitor

Re: Get person email from Get items without apply to each Loop

Thanks @rsaikrishna ;

I am confused about the Get Item and the list item ID concepts. My SP list is static, 2 column list, columns 'Title' and 'ProgramManager'. 

'Title' is my available "Programs" drop down choice, enforce unique values, text field, required. There are only 5 choices for Title to represent the 5 "Programs"

'ProgramManager' is person or group, single choice, person only(no Groups), required.

 

My Flow has a variable ProgramID that is set from a library column to match the SP list Title. My "Programs"

 

Get Item has a dynamic 'ID' that is populated, but I am unsure how to identify the the ProgramManger column and pull the email or name out of the person using just Get Item. 

 

I will try the set variable code you gave me, but would love to get a better understanding of the get Item action and its different uses.

  

Here is my Get Items:

getItems.JPG

 

and resulting Body :

{
  "value": [
    {
      "@odata.etag": "\"6\"",
      "ItemInternalId": "1",
      "ID": 1,
      "Title": "Programname",
      "ProgramManager": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|name@domain.com",
        "DisplayName": "Fname Lname",
        "Email": "name@domain.com",
        "Picture": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=name@domain.com",
        "Department": null,
        "JobTitle": null
      },
      "ProgramManager#Claims": "i:0#.f|membership|name@domain.com",
      "Modified": "2020-06-28T20:23:49Z",
      "Created": "2020-06-27T18:41:49Z",
      "Author": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|name@domain.com",
        "DisplayName": "Fname Lname",
        "Email": "name@domain.com",
        "Picture": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=name@domain.com",
        "Department": null,
        "JobTitle": null
      },
      "Author#Claims": "i:0#.f|membership|name@domain.com",
      "Editor": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|name@domain.com",
        "DisplayName": "Fname Lname",
        "Email": "name@domain.com",
        "Picture": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/UserPhoto.aspx?Size=L&AccountName=name@domain.com",
        "Department": null,
        "JobTitle": null
      },
      "Editor#Claims": "i:0#.f|membership|name@domain.com",
      "{Identifier}": "Lists%252fDocapprovalMatrix%252f1_.000",
      "{IsFolder}": false,
      "{Thumbnail}": {
        "Large": null,
        "Medium": null,
        "Small": null
      },
      "{Link}": "https://domain.sharepoint.com/sites/Testsite/_layouts/15/listform.aspx?PageType=4&ListId=076be45b-2e34-4c5e-b969-59e165b62ef1&ID=1&ContentTypeID=0x0100394CAD69C97E764AA4881BA5F296AB71",
      "{Name}": "Programname",
      "{FilenameWithExtension}": "Programname",
      "{Path}": "Lists/Matrix/",
      "{FullPath}": "Lists/Matrix/1_.000",
      "{HasAttachments}": false,
      "{VersionNumber}": "1.0"
    }
  ]
}

Helpful resources

Announcements
FirstImage

Microsoft Ignite 2020

Check out the announcement of Power Platform content at Microsoft Ignite!

thirdImage

Experience what's new for Power Automate

Join us for an in-depth look at the new Power Automate features and capabilities at the free Microsoft Business Applications Launch Event.

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Users online (6,511)