Setting a SharePoint Date only field value to the current date using List Formatting JSON


This post is based on a recent question that I got from a blog reader in a blog post related to List Formatting and setting field values:

I am trying to add an action button to my Microsoft list. The reason for this is that I would like the trip date column to populate with the current date the button was pressed. Just to make it easier for the executives to confirm they have completed a work trip. Can this be done thru list and conditional formatting and json coding?

We can use the customRowAction attribute with the setValue action type in list formatting to achieve this.

Basically we need to set a field value to the by retrieving the current date using the token @now (that detects the current date/time automatically).

This value brings the time automatically, so if we need to set the date only manually we can generate a string in the format ‘yyyy-MM-dd’ and it will also work, as below:

"customRowAction": {
          "action": "setValue",
         ...

Source link

More About This Author

michelcarlo
michelcarlo
SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff).

Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.

Author: michelcarlo

SharePoint and Office 365 Consultant/Developer always trying to get the best from Microsoft stack (Microsoft 365/Azure/Power Platform and related stuff). Living in Ireland since 2018, I had previously worked in Brazil as a consultant/developer for Office 365, SharePoint and related technologies for almost 10 years.

Share This Post On
Share via
Copy link
Powered by Social Snap