سؤال

I have a formatted Single Line Text field in a SharePoint Library. It is formatted to be a button that executes a Flow. I've created this so I can attach this one flow to multiple libraries. It works well for that purpose, but I need it to perform an additional action: update a different field for the current item.

There are 2 other fields:

  • Publishing_Status (choice)
  • Last_Published_Date (Date and Time)

Is it possible with a button like below to update the value of another field? Specifically to add a time stamp and select a choice for the choice field?

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column- formatting.schema.json",
  "elmType": "button",
  "customRowAction": {
  "action": "executeFlow",
  "actionParams": "{\"id\": \"ffa62926-6bbc-4db1-a409-1aeac8fdde93\"}"
  },
  "attributes": {
     "class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
  },
 "style": {
   "border": "none",
   "background-color": "transparent",
   "cursor": "pointer"
 },
 "children": [
 {
  "elmType": "span",
  "attributes": {
    "iconName": "Flow"
  },
  "style": {
    "padding-right": "6px"
  }
},
{
   "elmType": "span",
   "txtContent": "Publish"
  }
 ]
}

I wanted to use Flow to update the item, but as it may come from one of several libraries, it's not really possible (as far as I can tell).

Thanks.

هل كانت مفيدة؟

المحلول

The Flow designer for the Update Item action does limit you to "known" fields, which is frustrating because it is only a UI restriction. If you were to go through the process of exporting the JSON of your Flow, editing the JSON manually, and re-importing, you could use Update Item with entirely dynamic values. I do not recommended that for this simple operation as that would be a cumbersome process, and there is an easier workaround.

Use the Send an HTTP Request to SharePoint to use the REST API directly. You can use it whether you need to Create a new item in a list or Update and existing one. Every single part of that action can be a dynamic value, from the SiteURL and API path, to the headers and body. Follow that documentation to format the JSON of your POST body, and for most of your headers, although you can skip the Authorization, Digest, and content-length headers, as Flow will handle those for you.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top