English 中文(简体)
B. 建立微软公司 清单编号栏值对@now造成错误: 日期和时间
原标题:Setting Microsoft List date column value to @now causes error: Enter a date and time like this

Using JSON column formatting, I have set up a button in a Microsoft List that, when clicked, sets the value of three columns:

"customRowAction": {
"action": "setValue",
"actionInput": {
"St01Status": "=if([$St01Status] ==  Completed ,  Pending ,  Completed )",
"St01Appver": "=if([$St01Status] ==  Completed ,   ,  @me )",
"St01AppDate": "=if([$St01Status] ==  Completed ,   ,  @now )"
}

I have found that this line causes an error when using Chrome browser on one computer:

"St01AppDate": "=if([$St01Status] ==  Completed ,   ,  @now )"

The error is:

"Enter a date and time like this: 23/12/2012 2:25PM"

enter image description here

栏号为日期,包括时间。

因此,它不像现在产生的<代码>@now。

然而,在其他电脑上,它不会造成错误,并从事所期望的行为。

这似乎是由<代码>Language<>/code>造成的,在 Chrome贝里设定。

The button works as desired when language is set to English (United States).

The button causes an error when language is set to English (Australia).

Strangely, the locale of the SITE where the list resides is English (Australia) - so you would think the behaviour would be the other way around.

Question

How can I create a @now value that will work regardless of the language setting of the browser?

下面是浏览器和现场地方语言环境的屏幕。

“entergraph

“enterography

“entergraph

For reference, related questions were asked here but never received an answer:

Recording currentdate&time in SharePoint Online listsdingsbreak - need a strategic Solutions

https://techcommunity.microsoft.com/t5/sharepoint/add-date-created-entered-to-json-code-for-sharepoint-list/m-p/3618991

问题回答

I have a date & time (with date only settings) column in our SharePoint list.

我是利用这名女神职人员,对我课以罚款:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Update item",
  "customRowAction": {
    "action": "setValue",
    "actionInput": {
      "DateColumn": "=if([$Status]== Completed ,[$DateColumn],toLocaleDateString(@now))"
    }
  }
}

Where DateColumn and Status are internal names of SharePoint list columns. You can get the internal name of your column by following this article: How to find the Internal name of columns in SharePoint Online?

Output:

enter image description here





相关问题
Updating external list from sharepoint workflow - error

I ve created page workflow to update data in external list: When I execute this workflow, I get an error. I don t know what causes the error: I ve read about permissions to the Sharepoint system ...

热门标签