Forum Discussion

Annette1101's avatar
Annette1101
Brass Contributor
Nov 01, 2023

JSON Sharepoint List Action Button - update to today's date

I have a SharePoint list with a column button. When the button is pressed, based on other conditions, I want to update a SharePoint column (internal name SuspendEndDate) to the current date. SuspendEndDate is a date/Time column formatted as DateOnly, Standard format.

My format action on the button looks like this. What am I missing on the setValue for SuspendEndDate? Currently the column is not updating at all!

 

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "=if([$Status]=='Rejected','Resubmit',if([$Status]=='Suspend','Reinstate',''))",
"customRowAction": {
"action": "setValue",
"actionInput": {
"Status": "=if([$Status]=='Rejected','Resubmit',if([$Status]=='Suspend','Reinstate',''))",
"SuspendEndDate": "=if([$Status]=='Suspend',@now,'')"
}
},
"style": {
"border": "none",
"background-color": "=if([$Status]=='Rejected','#A4262C',if([$Status]=='Suspend','#a68cf6',''))",
"color": "#ffffff",
"cursor": "pointer",
"visibility": "=if([$Status]=='Rejected','visible',if([$Status]=='Suspend','visible','hidden'))"
}
}

2 Replies

Resources