Skip to main content

Notifications

Copilot Studio - Calling Actions from Copilot S...
Unanswered

Using PVA User Name to Get Items from SharePoint

(0) ShareShare
ReportReport
Posted on by 16

Hi,

I want to be able to do a Call to Action whereby the User's name is taken from PVA/Office 365 and used to filter and Get Item from a SharePoint List. The two SharePoint Columns are

 

  • "Title" - the name of the Pod
  • "Name" - Person lookup column

 

IE is Sally is using the PVA, the Flow would find Sally in Office 365, use the O365 Connector to find her email address, use the email address to lookup the correct person in the "Name" list column and get the corresponding information from the "Title" column.

 

It works find when I test it in an Instant flow, but when I try and put it in a PVA flow, it comes up with an error on the "Return value(s) to Power Virtual Agents" action:

 

"The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach."

 

Here is what I have created so far. Can anyone help?

 

stanswell84_0-1684518984639.png

 

 

 

 

 

Categories:
  • Pstork1 Profile Picture
    Pstork1 64,907 on at
    Re: Using PVA User Name to Get Items from SharePoint

    In the field where you return the value to the Bot.  First() would go around the Values dynamic content from the GetItems.  That will give you the first item that was retrieved.  Adding ?['Title'] would return just the Title field value from that first record.

  • stanswell84 Profile Picture
    stanswell84 16 on at
    Re: Using PVA User Name to Get Items from SharePoint

    Thanks @Pstork1  - where would I write First()?['Title'] ?

  • Pstork1 Profile Picture
    Pstork1 64,907 on at
    Re: Using PVA User Name to Get Items from SharePoint

    The problem is that the Get Items is going to return an array of records. It may be 0, 1, or more than one. But you need to process the array to turn it into some form of string to be able to return it to the Bot.  If you are expecting just one match you can use First()?['Title'] to get the Title column of the first record returned.  Otherwise you'll need to use the markdown language to format the table as a string.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,526

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,907

Leaderboard

Featured topics