0

I have a button that starts Approval flow, with 'visibility' attribute that hides it if 'Status' column has value. But users make double-click and open Flow panel twice or more times, so my flow runs multiple times. Can I add some logic to this json button that allows only one click and prevents users to start flow multiple times, until they refresh page?

Here is json code: Flow guid is stored in 'actionParams' key. It shows button only if 'RequestStatus' is Empty or Rejected ('visibility' key), but Status is changed later, after flow started, and does not protect from multiple clicks in the beginning..

For example in jQuery it was able with e.preventDefault(); or something, but don't know how to do same with json column formatting..

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Start Approval process",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"********-****-4519-a15f-f1710899a003\"}"
  },
  "style": {
    "background-color": "#0078d4",
    "color": "white",
    "max-width": "95px",
    "font-size": ".9em",
    "cursor": "pointer",
    "visibility": "=if([$RequestStatus]=='' || [$RequestStatus]=='Rejected' ,'visible','hidden')"
  }
}

update: Thank You Jerry!

Yes, unfortunately the only way I found is to add button description and 'title', that says that 'please press 1 time and wait..'. And also You can use 'runFlowButtonText' parameter in 'actionparams' to add some text to power automate launch panel..

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "attributes": {
    "title": "Please press button only _1 time_ and wait for panel appeared on the right"
  },
  "txtContent": "Press _1 time_ to Approve",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"*********************-f1710899a003\",\"headerText\":\"Approval\",\"runFlowButtonText\":\"Launch Approval\"}"
  },
  "style": {
    "background-color": "#0078d4",
    "color": "white",
    "max-width": "95px",
    "font-size": ".9em",
    "cursor": "pointer",
    "visibility": "=if([$RequestStatus]=='' || [$RequestStatus]=='Rejected' ,'visible','hidden')"
  }
}
1
  • The Flow has 'Start on selected item' type
    – Gennady G
    Feb 2, 2021 at 17:01

1 Answer 1

1

Per my knowledge there is not an option to make SharePoint not receiving following clicks. That is beyond the scope of JSON formatting.

Every button element has a required property, customRowAction, that specifies an action that's taken when the button is clicked. This action must be one of the supported events.

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.