0

I have a SharePoint Online list. I would like to format the column so when there is a value in a look up column the other "number" type column gets populated. Currently I am using

{

  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
   "elmType": "div",
   "txtContent": "=if([$columnLookUp.lookupValue] == '',0,1"
    
}

If the value of the look up field is null then the other number column should have value 0 and if the look up field has a value the number column will be 1. This works but it just displays the value in the view rather than change the value of the column. Is there way I can set the value using json. I was looking into setValue but couldn't get it to work. Maybe it needs button to work. I have tried the following but it didn't work

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "div",
 "customRowAction":{
"action": "setValue",
"actionInput":{
  "columnNumber": "=if([$columnLookUp.lookupValue] == '',0,1"
  }
}
}
1
  • To update the number column automatically, you have to use power automate flow. If you want to do it using JSON: you can create a button with setValue (lets say "Update Number" button) and you have to click the button manually for all items to update the number column. Commented May 20, 2022 at 12:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.