web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Select Action - Help w...
Power Automate
Answered

Select Action - Help with expression syntax

(0) ShareShare
ReportReport
Posted on by 10
Hi,
 
I'm trying to select just a few fields from a JSON array however I am unsure of the syntax for the mapping.
 
I have this JSON Array
 
[
  {
    "@odata.context": "https://default-a6574859-de41-472d-9901-f7360699b943.09.common.uk.azure-apihub.net/apim/dynamicssmbsaas/shared-dynamicssmbsa-cc155aff-bd22-4890-8daf-154401d9f385/$metadata#bcenvironments('SANDBOX')/companies(fe0d2a07-199d-ef11-8a6b-6045bd1304c1)/datasets('v2.0')/tables('salesOrderLines')/items",
    "value": [
      {
        "@odata.etag": "W/\"JzIwOzE3MjE0NzkzODEzOTcyNDkwMzk2MTswMDsn\"",
        "ItemInternalId": "277aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "id": "277aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "documentId": "237aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "sequence": 1,
        "itemId": "6b06e355-e592-ef11-8a6b-6045bdfbe09a",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "lineType@odata.type": "#Microsoft.NAV.invoiceLineAggLineType",
        "lineType": "Item",
        "lineObjectNumber": "1234",
        "description": "TestProduct1",
        "description2": "",
        "unitOfMeasureId": "e03023a6-60e0-ee11-904f-0022484315d5",
        "unitOfMeasureCode": "CASE",
        "quantity": 99,
        "unitPrice": 99.99,
        "discountAmount": 0,
        "discountPercent": 0,
        "discountAppliedBeforeTax": false,
        "amountExcludingTax": 999.9,
        "taxCode": "20% VAT",
        "taxPercent": 20,
        "totalTaxAmount": 99.99,
        "amountIncludingTax": 999.99,
        "invoiceDiscountAllocation": 0,
        "netAmount": 999.9,
        "netTaxAmount": 99.99,
        "netAmountIncludingTax": 999.99,
        "shipmentDate": "2024-01-01",
        "shippedQuantity": 0,
        "invoicedQuantity": 0,
        "invoiceQuantity": 99,
        "shipQuantity": 99,
        "itemVariantId": "00000000-0000-0000-0000-000000000000",
        "locationId": "4e05507c-60e0-ee11-904f-0022484315d5"
      },
      {
        "@odata.etag": "W/\"JzE5Ozc0NTUzMjc4Mzg3MjU3ODM3NDIxOzAwOyc=\"",
        "ItemInternalId": "2c7aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "id": "2c7aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "documentId": "237aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "sequence": 2,
        "itemId": "6a06e355-e592-ef11-8a6b-6045bdfbe09a",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "lineType@odata.type": "#Microsoft.NAV.invoiceLineAggLineType",
        "lineType": "Item",
        "lineObjectNumber": "4321",
        "description": "TestProduct2",
        "description2": "",
        "unitOfMeasureId": "e03023a6-60e0-ee11-904f-0022484315d5",
        "unitOfMeasureCode": "CASE",
        "quantity": 99,
        "unitPrice": 99.99,
        "discountAmount": 0,
        "discountPercent": 0,
        "discountAppliedBeforeTax": false,
        "amountExcludingTax": 999.9,
        "taxCode": "20% VAT",
        "taxPercent": 20,
        "totalTaxAmount": 99.99,
        "amountIncludingTax": 999.99,
        "invoiceDiscountAllocation": 0,
        "netAmount": 999.9,
        "netTaxAmount": 99.99,
        "netAmountIncludingTax": 999.99,
        "shipmentDate": "2024-01-21",
        "shippedQuantity": 0,
        "invoicedQuantity": 0,
        "invoiceQuantity": 99,
        "shipQuantity": 99,
        "itemVariantId": "00000000-0000-0000-0000-000000000000",
        "locationId": "4e05507c-60e0-ee11-904f-0022484315d5"
      },
      {
        "@odata.etag": "W/\"JzE5OzEzOTM4OTU3MzI4NzY1NzQ4OTQxOzAwOyc=\"",
        "ItemInternalId": "317aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "id": "317aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "documentId": "237aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
        "sequence": 3,
        "itemId": "8351e261-e592-ef11-8a6b-6045bdfbe09a",
        "accountId": "00000000-0000-0000-0000-000000000000",
        "lineType@odata.type": "#Microsoft.NAV.invoiceLineAggLineType",
        "lineType": "Item",
        "lineObjectNumber": "5555",
        "description": "TestProduct3",
        "description2": "",
        "unitOfMeasureId": "e03023a6-60e0-ee11-904f-0022484315d5",
        "unitOfMeasureCode": "CASE",
        "quantity": 99,
        "unitPrice": 99.99,
        "discountAmount": 0,
        "discountPercent": 0,
        "discountAppliedBeforeTax": false,
        "amountExcludingTax": 999.99,
        "taxCode": "20% VAT",
        "taxPercent": 20,
        "totalTaxAmount": 999.99,
        "amountIncludingTax": 9999.99,
        "invoiceDiscountAllocation": 0,
        "netAmount": 999.99,
        "netTaxAmount": 999.99,
        "netAmountIncludingTax": 9999.99,
        "shipmentDate": "2024-01-01",
        "shippedQuantity": 0,
        "invoicedQuantity": 0,
        "invoiceQuantity": 99,
        "shipQuantity": 99,
        "itemVariantId": "00000000-0000-0000-0000-000000000000",
        "locationId": "4e05507c-60e0-ee11-904f-0022484315d5"
      }
    ]
  }
]
 
I wish to say select, "id" and "documentId" from this to pass into another action, but in my output I just get all my objects assigned to both id and documentId.
 
{
    "body": [
        {
            "id": {
                "@odata.etag": "W/\"JzE5OzQ1MzI2MzUxOTI2Mjk2MDU4NDAxOzAwOyc=\"",
                "ItemInternalId": "367aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "id": "367aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "documentId": "237aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "sequence": 1,
                "itemId": "8451e261-e592-ef11-8a6b-6045bdfbe09a",
                "accountId": "00000000-0000-0000-0000-000000000000",
                "lineType@odata.type": "#Microsoft.NAV.invoiceLineAggLineType",
                "lineType": "Item",
                "lineObjectNumber": "1234",
                "description": "TestProduct1",
                "description2": "",
                "unitOfMeasureId": "e03023a6-60e0-ee11-904f-0022484315d5",
                "unitOfMeasureCode": "CASE",
                "quantity": 99,
                "unitPrice": 99.99,
                "discountAmount": 0,
                "discountPercent": 0,
                "discountAppliedBeforeTax": false,
                "amountExcludingTax": 999.99,
                "taxCode": "20% VAT",
                "taxPercent": 20,
                "totalTaxAmount": 999.99,
                "amountIncludingTax": 9999.99,
                "invoiceDiscountAllocation": 0,
                "netAmount": 999.99,
                "netTaxAmount": 999.99,
                "netAmountIncludingTax": 9999.99,
                "shipmentDate": "2024-01-01",
                "shippedQuantity": 0,
                "invoicedQuantity": 0,
                "invoiceQuantity": 99,
                "shipQuantity": 99,
                "itemVariantId": "00000000-0000-0000-0000-000000000000",
                "locationId": "4e05507c-60e0-ee11-904f-0022484315d5"
            },
            "documentId": {
                "@odata.etag": "W/\"JzE5OzQ3MzA5MDA1NTE2MzgwODE5NTUxOzAwOyc=\"",
                "ItemInternalId": "3b7aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "id": "3b7aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "documentId": "237aaf99-ba9d-ef11-8a6b-7c1e5203ae35",
                "sequence": 2,
                "itemId": "7e51e261-e592-ef11-8a6b-6045bdfbe09a",
                "accountId": "00000000-0000-0000-0000-000000000000",
                "lineType@odata.type": "#Microsoft.NAV.invoiceLineAggLineType",
                "lineType": "Item",
                "lineObjectNumber": "4321",
                "description": "TestProduct2",
                "description2": "",
                "unitOfMeasureId": "e03023a6-60e0-ee11-904f-0022484315d5",
                "unitOfMeasureCode": "CASE",
                "quantity": 99,
                "unitPrice": 99.99,
                "discountAmount": 0,
                "discountPercent": 0,
                "discountAppliedBeforeTax": false,
                "amountExcludingTax": 999.99,
                "taxCode": "20% VAT",
                "taxPercent": 20,
                "totalTaxAmount": 999.99,
                "amountIncludingTax": 9999.99,
                "invoiceDiscountAllocation": 0,
                "netAmount": 999.99,
                "netTaxAmount": 999.99,
                "netAmountIncludingTax": 9999.99,
                "shipmentDate": "2024-01-01",
                "shippedQuantity": 0,
                "invoicedQuantity": 0,
                "invoiceQuantity": 99,
                "shipQuantity": 99,
                "itemVariantId": "00000000-0000-0000-0000-000000000000",
                "locationId": "4e05507c-60e0-ee11-904f-0022484315d5"
            }
        }
Would someone be able to help witht he expression I need to only return the two fields? Thanks
Categories:
  • Verified answer
    Ellis Karim Profile Picture
    12,277 Super User 2026 Season 2 on at

    Try the following expressions:

    variables('varJSON')?[0]?['value']
    item()?['id']
    item()?['documentId']



     
    Here is the runtime output based on your sample data:
     
     
    Ellis
  • SO-02121639-0 Profile Picture
    10 on at
    Amazing, that worked perfectly, thank you!
  • SO-02121639-0 Profile Picture
    10 on at
    When I use this in a loop, the input data doesn't increment - would you happen to know why?
     
    When stepping through "For Each OrderNo" - the input/put do vary based on the OrderNo, however the Select input (and therefore output) remain the same as the first Input.
     
     
     
     
     
     
     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 221 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 132

Last 30 days Overall leaderboard