Forum Discussion

avytrykh's avatar
avytrykh
Copper Contributor
Jul 15, 2021
Solved

Use lookup value in column formatting.

Hi community I have format of the column Accept docs like below: { "$schema": "https: //developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json", "elmType": "span", ...
  • RobElliott's avatar
    Jul 15, 2021

    avytrykh you've got an elm type of span AND an elm type of button both operating on the same item. That's the main cause of your problem; I would remove that span with the if currentfield txtcontent. The following will work (change flow ID and the column name to yours):

    	{
      "$schema": "https: //developer.microsoft.com/en-us/json-schemas/sp/column-formatting.schema.json",
          "elmType": "button",
          "txtContent": "Accept",
          "customRowAction": {
            "action": "executeFlow",
            "actionParams": "{\"id\":\"0eb7e84b-4158-47b0-b19e-aff0aa26af3d\", \"headerText\":\"Sign Off\",\"runFlowButtonText\":\"Request Sign Off\"}"
      },
          "style": {
            "background-color": "#2ca1e8",
            "color": "white",
            "visibility": "=if([$Project.lookupValue] == 'G-HERC', 'visible',  'hidden')"
    
          }
        }

     

    Rob
    Los Gallardos
    Intranet, SharePoint, Website and Power Platform Manager (and classic 1967 Morris Traveller driver)

Resources