Forum Discussion

anonymous9376's avatar
anonymous9376
Brass Contributor
May 10, 2022
Solved

Cancel a leave request after it's been approved

Hi, I'm developing a leave request system in Sharepoint and using Power Automate for the approval workflow. I wanna know that if an employee applies for a leave in the SP list and it has been approved, is it possible for the employee to cancel the leave? If it's possible, how can I do that?

Thank you.

  • RobElliott's avatar
    RobElliott
    May 10, 2022

    anonymous9376 you could have a view of the leave list showing just the logged-in employee's leave request. A JSON-formatted button could be next to each one which would trigger a separate flow to cancel the leave request and update the status column.

     

    Rob
    Los Gallardos
    Microsoft Power Automate Community Super User

  • Warwick Ward's avatar
    Warwick Ward
    Bronze Contributor
    As you are not using a out-of-the-box / turn-ley solution, you can and need to build this logic into your process.

    One way would be for a user to edit this approved leave request entry in the SharePoint list and change a drop down from Approved to Cancelled. This would then start a Power Automate flow to perform the approval/notification/calculation logic for the process you required.

    Happy SharePointing!!!
    • anonymous9376's avatar
      anonymous9376
      Brass Contributor
      Hi Warwick Ward, even if the Approved and Rejected are triggered from the approval workflow from the Power Automate, the user can simply change it to Cancelled? What do you mean by, 'This would then start a Power Automate flow to perform the approval/notification/calculation logic for the process you required.' ?
      Thank you.
      • RobElliott's avatar
        RobElliott
        Silver Contributor

        anonymous9376 that wouyld look like this:

         

        And the JSON is (but would use your flow ID):

         

        {
          "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
          "elmType": "button",
          "txtContent": "Cancel Leave Request",
          "customRowAction": {
            "action": "executeFlow",
            "actionParams": "{\"id\": \"01f36bf6-d218-43b2-8c9c-f718b10f9fbf\"}"
          },
          "style": {
            "background-color": "#c00000",
            "color": "white",
            "visibility": "=if([$Status] == 'Completed' || [$Status] == 'Cancelled','hidden','visible')"
          }
        }

         

        Rob
        Los Gallardos
        Microsoft Power Automate Community Super User

Resources