Forum Discussion
Paul_Dillon
Jan 29, 2026Copper Contributor
SharePoint List button not working!
Hi all, I have a Property Key Check In/Out list and trying to include a button to auto populate the fields. Using the JSON below, but it isn't working. I've isolated the Status field and that works, ...
virendrak
Jan 30, 2026Iron Contributor
For setValue in column formatting, a single‑select Person field actually expects the person token directly, not an object.
For a single‑person field, this is the correct pattern:
"CheckedOutByColleague": "=if([$Status] == 'IN', , '')"After several iterations and guidance from Copilot, I was finally able to produce the correct working JSON.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"style": {
"padding": "6px 12px",
"border-radius": "6px",
"border": "1px solid",
"cursor": "pointer",
"font-weight": 600,
"background-color": "=if([$Status] == 'IN', '#107c10', '#d83b01')",
"border-color": "=if([$Status] == 'IN', '#0b6a0b', '#be3700')",
"color": "white"
},
"attributes": {
"title": "=if([$Status] == 'IN', 'Check this key OUT', 'Check this key IN')",
"aria-label": "=if([$Status] == 'IN', 'Check this key OUT', 'Check this key IN')"
},
"txtContent": "=if([$Status] == 'IN', 'Check Out', 'Check In')",
"customRowAction": {
"action": "setValue",
"actionInput": {
"Status": "=if([$Status] == 'IN', 'OUT', 'IN')",
"CheckedOutByColleague": "=if([$Status] == 'IN', , '')",
"WhenCheckedOut": "=if([$Status] == 'IN', @now, '')"
}
}
}
If my post solved your issue or answered your query, please mark it as a Solution and give it a Like.