Forum Discussion

Xv's avatar
Xv
Copper Contributor
Nov 02, 2020
Solved

Is it possible to reference a list item value for headerText in actionParams

I'd like to reference a list item's column value in actionParams headerText. In the code below I want the value of list column Purpose to be displayed in the headerText :   [$Purpose] Is it pos...
  • theChrisKent's avatar
    Apr 02, 2021

    Xv 

    Yes! You can do this using an expression that builds the escaped JSON needed for the actionParams. It's a bit confusing to look at with all of the escaped quotes, but it works!

     

    The actionParams property can be set with an expression. In this case we are going to treat the whole thing like text by surrounding our escaped JSON value with single quotes. Then we can add our dynamic value as part of that text. So we can take your format and adjust the property value to an expression like this:

     

    {
      "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
      "elmType": "button",
      "txtContent": "Req update",
      "customRowAction": {
        "action": "executeFlow",
        "actionParams": "='{\"id\":\"6876124d-ff27-47df-a446-06b9c64ed95a\", \"headerText\":\"Request update to ' + [$Purpose] + '\",\"runFlowButtonText\":\"Send update request\"}'"
      }
    }

     

Resources