Question

I'm using JSON formatting on a column to create an inline "Start flow on this item" from the library's list view. This part is what starts the flow.

 {
  "elmType": "button",
  "style": {
    "border": "none",
    "background-color": "transparent",
    "color": "#0078d7",
    "cursor": "pointer"
  },
  "txtContent": "Start update",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"flow guid\"}"
  }
}

I can't remember where I found the tutorial on this, but it does work and starts the correct flow. And in the Flow I am able to inspect the trigger outputs and see that it correctly passed the ID, itemUrl, fileName, and FileId of the correct item. The flow runs and can perform multiple steps, but if I have a step that tries to interact with the file at all it fails with the following error.

Unable to process template language expressions in action 'Check_out_file' inputs at line '1' and column '2179': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_sharepointonline']['connectionId']' cannot be evaluated because property 'X-MS-APIM-Tokens' doesn't exist, available properties are 'Connection, Accept, Accept-Encoding, Accept-Language, Host, Referer, User-Agent, origin, sec-fetch-site, sec-fetch-mode, sec-fetch-dest, Content-Length, Content-Type'. Please see https://aka.ms/logicexpressions for usage details.'.

I've searched and found other threads, like this or this. They either don't have a solution or suggest recreating or deleting and reimporting the flow. I've tried both of those and have not had any success -- which seems to agree with what other folks suggest as well.

The idea for this flow is that I will be able to use the trigger outputs to manipulate the specific file that the flow was started for. Basically that I don't have to hard code the library and filename into steps like SharePoint: Check out file or Excel: Get tables.

I first saw this error when I tried to access the file using the trigger output information. But then I hard coded the file into my flow and I still see the error -- but only if I trigger it from the json. If I test run or trigger the exact same flow from Power Automate it works just fine.

Is there a way to get a customRowAction executeFlow to work with and manipulate the contents of a library?

Is there a way to provide X-MS-APIM-Tokens? When I test trigger the

Is there some other way to remotely start a flow on a specific item?

Was it helpful?

Solution

The issue was the trigger step for the flow. Even though Microsoft's own tutorial

Give your flow a name in the Flow name > Manually trigger a flow > Create.

has you use the manual step, you can't use that if you plan to trigger the flow using JSON custom coding to start the flow. You have to use the For a selected file or item trigger step.

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top