Search code examples
sharepointpower-automatesharepoint-list

How can I "force" SharePoint list data to populate in my Power Automate Flow using a Formula Expression?


I know that Dynamic expressions can be finicky at the best of times (and I'm absolutely ready to accept that there is something I'm forgetting here) but there is data that is not showing up when I try to add it to my workflow:

Missing Department Data

enter image description here

I know there is a way to "force" data into those field using an expression, but for the life of me I cannot remember how to do that. If anyone can point me in the direction of the proper documentation for that it would be VERY much appreciated. I don't think I'm phrasing any of this correctly. Or at the very least, If someone could explain to me why my "Department" column is not showing up (it is a single text column in the SharePoint list) with the rest of the options.


Solution

  • I'm not sure why the dynamic property isn't showing up. Regardless though, you should still be able to get the value of the relevant parameter.

    This is an example of the run log for a manually pushed button.

    Run

    If you hit the Show raw outputs button, you'll get the JSON that's generated and passed through from the trigger to the flow.

    {
        "headers": {
            "Connection": "Keep-Alive",
            "Accept": "application/json; charset=utf-8",
            "Accept-Encoding": "gzip,deflate",
            "Accept-Language": "en-au",
            "Expect": "100-continue",
            "Host": "prod-02.australiasoutheast.logic.azure.com",
            "User-Agent": "Power%20Automate/4.210203.6,CFNetwork/1404.0.5,Darwin/22.3.0",
            "X-MS-APIM-Referrer": "https://australia-001.azure-apim.net/apim/logicflows/masked",
            "x-ms-client-region": "australia",
            "x-ms-flavor": "Production",
            "x-ms-gateway-object-id": "",
            "X-MS-APIM-Referrer-Prefix": "https://australia-001.azure-apim.net/apim/logicflows/88a43aa8-ac75-masked",
            "X-MS-APIM-Callback": "https://australia-001.consent.azure-apim.net",
            "x-ms-user-id": "8ddf4a13-masked",
            "x-ms-user-name": "Joe Bloggs",
            "x-ms-user-name-encoded": "Sm9lIEJsb2dncw==",
            "x-ms-user-email": "[email protected]",
            "x-ms-user-email-encoded": "am9lLmJsb2dnc0BlbWFpbC5jb20uYXU=",
            "x-ms-user-timestamp": "2023-04-23T10:07:26.5382614Z",
            "X-Forwarded-For": "",
            "Content-Length": "249",
            "Content-Type": "application/json"
        },
        "body": {
            "user": {
                "displayName": "Joe Bloggs",
                "email": "[email protected]"
            },
            "key-button-timestamp": "2023-04-23T20:07:25+10:00",
            "key-button-date": "2023-04-23",
            "text": "Test 1",
            "text_1": "Test 2",
            "text_2": "Option 2",
            "text_3": [
                "Option 2",
                "Option 3"
            ]
        }
    }
    

    It's that JSON that you can use in any expression down the line.

    So if you want to retrieve the key-button-date property, you would use this expression ...

    triggerBody()?['key-button-date']
    

    A quick explanation ...

    1. triggerBody() retrieves the content of the body object in the json.
    2. The question mark ? indicates that it will not error if the child property you're requesting does not exist. The question mark is not mandatory.
    3. This is where it gets the child property and the name of that property, as you can see, is key-button-date.

    If the JSON was nested further, you just keep going, e.g. ...

    triggerBody()?['key-button-date']?['Example 1']?['Example 2']
    

    Key Button Date

    This may help to explain further ...

    https://learn.microsoft.com/en-us/azure/logic-apps/logic-apps-workflow-definition-language#expressions