SOLVED

Conditional formatting on sharepoint list column with flow buttons

%3CLINGO-SUB%20id%3D%22lingo-sub-1526440%22%20slang%3D%22en-US%22%3EConditional%20formatting%20on%20sharepoint%20list%20column%20with%20flow%20buttons%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1526440%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22contentStandard%22%3EI'm%20trying%20to%20include%20a%20button%20to%20conditionally%20launch%20a%20flow%20on%20an%20item%20of%20a%20SharePoint%20List.%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3EI%20have%20a%20list%20with%20multiple%20columns%2C%20such%20as%20%3CEM%3EStatus%3C%2FEM%3E%2C%20%3CEM%3EApproval%3C%2FEM%3E%20and%20%3CEM%3ECreated_By%3C%2FEM%3E.%20I%20want%20the%20%3CEM%3EApproval%3C%2FEM%3E%20column%20to%20show%20buttons%20that%20can%20launch%20a%20Power%20Automate%20Flow%20on%20the%20list%20item.%20And%20these%20buttons%20should%20be%20different%20in%20the%20following%20situations%3A%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EWhen%20the%20field%20in%20the%20%3CEM%3EStatus%3C%2FEM%3E%20column%20equals%20'Draft'%20-%26gt%3B%20Show%20button%20to%20start%20Flow%201%3C%2FLI%3E%3CLI%3EWhen%20the%20field%20in%20the%20%3CEM%3EStatus%3C%2FEM%3E%20column%20equals%20'Approved'%20-%26gt%3B%20Show%20button%20to%20start%20Flow%202%3C%2FLI%3E%3CLI%3EWhen%20the%20person%20who%20views%20the%20list%20is%20not%20the%20creator%20of%20the%20item%20-%26gt%3B%20Show%20no%20button%3C%2FLI%3E%3C%2FOL%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3E%3CSPAN%3EThe%20method%20to%20include%20a%20button%20to%20launch%20a%20flow%2C%20using%20a%20formatted%20column%2C%20can%20be%20found%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsharepoint%2Fdev%2Fdeclarative-customization%2Fcolumn-formatting%23create-a-button-to-launch-a-flow%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20H%3CSPAN%3Eowever%20this%20example%20does%20not%20include%20conditional%20statements.%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3EI%20found%20that%20it%20is%20possible%20to%20include%26nbsp%3B%3C%2FSPAN%3E%3CEM%3EIF%3C%2FEM%3E%3CSPAN%3E%26nbsp%3Bstatements%20in%20the%20JSON%20code.%20The%20%3CEM%3EStatus%3C%2FEM%3E%20can%20be%20checked%20with%20the%20following%20code%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22%3Dif(%5B%24Status%5D%20%3D%3D%20'Approved'%2C''%2C'')%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentCodeblock%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3EWhether%20the%20person%20who%20is%20viewing%20the%20list%20is%20the%20same%20as%20the%20person%20who%20created%20the%20item%20should%20be%20possible%20to%20check%20with%20something%20like%20this%20(although%20this%20specific%20piece%20of%20code%20does%20not%20work..)%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22%3Dif(%40me%20%3D%3D%20%5B%24Created_x0020_By.email%5D%2C''%2C'')%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentCodeblock%22%3E%26nbsp%3B%3C%2FP%3E%3CP%20class%3D%22contentStandard%22%3EI'm%20not%20really%20known%20with%20JSON%20so%20I%20don't%20know%20how%20to%20insert%20these%20conditions%20into%20the%20code%20of%20the%20example.%20So%20I'd%20like%20to%20ask%20your%20help!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1526440%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFlow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EJson%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELists%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1532513%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20formatting%20on%20sharepoint%20list%20column%20with%20flow%20buttons%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1532513%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F730689%22%20target%3D%22_blank%22%3E%40StevenKox%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESolved!%20See%20%3CA%20href%3D%22https%3A%2F%2Fstackoverflow.com%2Fquestions%2F62916927%2Fconditional-formatting-on-sharepoint-list-column-with-flow-buttons%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%20post%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

I'm trying to include a button to conditionally launch a flow on an item of a SharePoint List.

 

I have a list with multiple columns, such as Status, Approval and Created_By. I want the Approval column to show buttons that can launch a Power Automate Flow on the list item. And these buttons should be different in the following situations:

 

  1. When the field in the Status column equals 'Draft' -> Show button to start Flow 1
  2. When the field in the Status column equals 'Approved' -> Show button to start Flow 2
  3. When the person who views the list is not the creator of the item -> Show no button

 

The method to include a button to launch a flow, using a formatted column, can be found here. However this example does not include conditional statements. I found that it is possible to include IF statements in the JSON code. The Status can be checked with the following code: 

 

"=if([$Status] == 'Approved','','')"

 

 

Whether the person who is viewing the list is the same as the person who created the item should be possible to check with something like this (although this specific piece of code does not work..): 

 

"=if(@me == [$Created_x0020_By.email],'','')"

 

 

I'm not really known with JSON so I don't know how to insert these conditions into the code of the example. So I'd like to ask your help!

1 Reply
Highlighted