0

I would like to know if there is any chance with JSON to automatically trigger a flow from a SharePoint list without a button. Just when a new item is created.

The solution with the buttons is as:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"edf627d9-20f4-45ba-8bc9-4494bf2ff1be\"}"
  },
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
  "style": {
    "border": "none",
    "background-color": "transparent",
    "cursor": "pointer"
  },
  "children": [
    {
      "elmType": "span",
      "attributes": {
        "iconName": "Flow"
      },
      "style": {
        "padding-right": "6px"
      }
    },
    {
      "elmType": "span",
      "txtContent": "It's Flow Time!"
    }
  ]
}

Would be possible to define a condition like the two columns, Modified == Created, to automatically call a flow when a new item is created?

Also there is option to call the flow via http:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "a",
  "txtContent": "Create Unique ID",
  "attributes": {
    "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover",
    "target": "_blank",
    "href": "=if([$Created]==[$Modified],'https://prod-xxx.westeurope.logic.azure.com:443/workflows/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx','')"
  },
  "style": {
    "border": "none",
    "text-decoration": "none",
    "background-color": "transparent",
    "color": "red",
    "cursor": "pointer"
  }
}

Thank you

2 Answers 2

2

Fernando,

Power automate has a standard sharepoint list flow trigger of 'When a new item is created':

enter image description here

In the settings, the trigger conditions can be set using a formula:

enter image description here

So long as this flow is activated, when a new item is added (and providing trigger conditions are met) it will run - no JSON coding needed.

Hope this helps.

1
  • Yeap, thank you, if we create a flow per list we need 1200 flows in our Project Online instance: 3 lists per site x 400 projects. Not working for us. On top of that, the user has to configure this manually for every new project, when a new project is created (new project site), we do not expect the Project Managers to do this. May 12 at 16:15
0

Yeap, thank you, if we create a flow per list we need 1200 flows in our Project Online instance: 3 lists per site x 400 projects. Not working for us. On top of that, the user has to configure this manually for every new project, when a new project is created (new project site), we do not expect the Project Managers to do this.

4
  • Welcome to the site! FYI: This should be a comment on @Bh1208's answer rather than an answer itself. May 12 at 15:20
  • I don't recommend solving this with Flow. Even if you did find a way to provision that many flows, maintenance would be a nightmare. Also, flows that don't run for 90 days will just shut off so you'll be constantly trying to turn them back on if there aren't frequent updates. To @Bh1208's point, however, this has nothing to do with formatting. An executeFlow action will only happen when manually pressed and still requires the flows to be associated to the list. May 12 at 15:23
  • A better solution is likely to use webhooks with a custom Azure Function to manage subscriptions with a registration call as part of your provisioning. It's more complex, but your solution falls outside of normal use case for Power Automate. May 12 at 15:24
  • Hi @theChrisKent ! Thank you for having a look! I thought with JSON we could automate this without a button to call the flow with some condition. Do you know if the executeFlow action accepts parameters? I definitely have to research on webhooks. May 12 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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