Forum Discussion
SharePoint List button not working!
Unfortunately, column formatting JSON cannot set Person or DateTime fields dynamically. Microsoft only allows setValue for Text, Choice, Number, Yes/No fields.
>>That’s why your Status field works fine, but the Person and DateTime ones fail.
Think of JSON column formatting like a paintbrush — it can change how things look and do simple actions (like flipping a switch). But it can’t write complex values like people or timestamps. For those, you need a toolbox (Power Automate or Power Apps) that can handle more advanced logic.
your JSON is fine for Status, but you’ll need Power Automate or Power Apps to populate Person and DateTime.
Power Automate flow that will handle the Person and DateTime fields whenever your JSON button flips the Status column. This way, you keep the button simple (just toggling IN/OUT), and let the flow fill in the rest.
Flow Setup
- Trigger
- Go to Power Automate → Create → Automated cloud flow.
- Choose trigger: When an item is created or modified (SharePoint).
- Select your site and the Property Key Check In/Out list.
- Condition
- Add a Condition action:
- If Status equals OUT → then we know the key was checked out.
- Else → it was checked in.
- Add a Condition action:
- Update Item
- In the Yes branch (Status = OUT):
- Add Update item action.
- Set:
- CheckedOutByColleague → Modified By (dynamic content).
- WhenCheckedOut → utcNow() (use an expression).
- In the No branch (Status = IN):
- Add Update item action.
- Set:
- CheckedOutByColleague → leave blank (or clear field).
- WhenCheckedOut → leave blank.
- In the Yes branch (Status = OUT):
- Save & Test
- Save the flow.
- Go back to your list, click the JSON button to toggle Status.
- Flow will run and auto‑populate the Person and DateTime fields.
🤖 If my post solved your issue or answered your query, please mark it as a Solution and give it a Like.