0

In my flow, I need to get the value of a specific column (ApprovalType) for an item in a SharePoint list.

First, I use Get Items with a filter query which gets to one item. This produces an array. This list is updated frequently, so I can't use Get Item with an item ID.

How can I get the value of the approval column from the output of the Get Items? The output is below, with user info changed.

    "@odata.etag": "\"3\"",
    "ItemInternalId": "1",
    "ID": 1,
    "Title": "Files",
    "Department": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
        "Id": 8,
        "Value": "Legal"
    },
    "Department#Id": 8,
    "ApprovalType": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
        "Id": 0,
        "Value": "First to respond"
    },
    "ApprovalType#Id": 0,
    "Approvers": [
        {
            "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            "Claims": "i:0#.f|membership|[email protected]",
            "DisplayName": "User1",
            "Email": "[email protected]",
            "Picture": "https://exampleurl.com",
            "Department": "Information Systems",
            "JobTitle": "Help Desk II"
        },
        {
            "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            "Claims": "i:0#.f|membership|user2",
            "DisplayName": "User2",
            "Email": "user2",
            "Picture": "https://exampleurl.com",
            "Department": null,
            "JobTitle": null
        },
        {
            "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            "Claims": "i:0#.f|membership|user3",
            "DisplayName": "User3",
            "Email": "user3",
            "Picture": "https://exampleurl.com",
            "Department": "Information Systems",
            "JobTitle": "Help Desk II"
        }
    ],
    "[email protected]": "#Collection(Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser)",
    "Approvers#Claims": [
        "i:0#.f|membership|[email protected]",
        "i:0#.f|membership|user2",
        "i:0#.f|membership|user3"
    ],
    "Approvers#[email protected]": "#Collection(String)",
    "Modified": "2023-07-10T15:48:25Z",
    "Created": "2023-06-21T15:00:22Z",
    "Author": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|user2",
        "DisplayName": "User2",
        "Email": "user2",
        "Picture": "https://exampleurl.com",
        "Department": null,
        "JobTitle": null
    },
    "Author#Claims": "i:0#.f|membership|user2",
    "Editor": {
        "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        "Claims": "i:0#.f|membership|user2",
        "DisplayName": "User1",
        "Email": "user2",
        "Picture": "https://exampleurl.com",
        "Department": null,
        "JobTitle": null
    },
    "Editor#Claims": "i:0#.f|membership|user2",
    "{Identifier}": "Lists%252fApproverMatrix%252f1_.000",
    "{IsFolder}": false,
    "{Thumbnail}": {
        "Large": null,
        "Medium": null,
        "Small": null
    },
    "{Link}": "https://exampleurl.com",
    "{Name}": "Files",
    "{FilenameWithExtension}": "Files",
    "{Path}": "Lists/ApproverMatrix/",
    "{FullPath}": "Lists/ApproverMatrix/1_.000",
    "{HasAttachments}": false,
    "{VersionNumber}": "3.0"
}

2 Answers 2

1

If you are sure you will always get only "one item" in response array from "Get items" action, you can use an expression like below to get the value of Approval Type choice column:

outputs('Get_items')?['body/value'][0]['ApprovalType']?['Value']

Where ApprovalType is the internal name of your list column. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

Flow:

enter image description here

Output:

enter image description here


Solution 2:

Use Apply to each action > use output from get items action as input to apply to each > add compose action inside apply to each and select Approval Type Value from dynamic content like:

enter image description here

1
  • 1
    That provided exactly what I needed - thank you! Specifically, adding "?['Value'] to the output.
    – DeNaeL
    Jul 13, 2023 at 14:43
-1

One way would be to add a Get Item action after your Get Items action and for the ID set the expression to:

outputs('Get_items')?['body/value'][0]?['ID']

('Get_items') This would need to be updated with the correct name of your Get Items action if you've renamed it

[0] This is the first (and hopefully only) item in your get items array

?['ID'] This specifies to use the value of the ID field

After that, you can use the outputs of the Get Item action as required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.