Search code examples
power-automatesharepoint-list

How do we resolve that a Power Automate Sharepoint "Create item" action has changes in the UI that aren't reflected in Code View?


Changes to target different columns in a Power Automate Sharepoint list "Create item" action aren't reflected in the Code View of the action.

Although undesirable in and of itself this can cause a related problem. When you put a flow in a solution then export/import the solution to a new environment (or do this via a Pipeline): the flow in the target environment doesn't get updated according to what you set in the flow in the source environment, through the UI.

Reproduce the UI update V Code View mismatach:

  • Create a Sharepoint List, MyListDev with columns:
    • CoolCountry. Type: Single line of text;
    • SubmissionTimestamp: Type = Date and time; Include Time = Yes
    • SubmissionDatetime: Type = Date and time; Include Time = Yes
  • Create FieldSettingMweFlow02 with Actions
    • "Manually trigger a flow"
    • Sharepoint "Create item"
      • Site address: your site
      • List name: MyListDev
      • Parameters > CoolCountry: MexicoDEV
      • Parameters > SubmissionDatetime: utcNow()
    • Save
    • Test; Manually; [Test] ... [Run flow]
    • Observe Data good in Sharepoint MyListDev
  • Edit FieldSettingMweFlow02
    • Edit Sharepoint "Create item"
      • Parameters > SubmissionDatetime: [Blank]
      • Parameters > SubmissionTimestamp: utcNow()
    • Save;
    • Test; Manually; [Test] ... [Run flow]
    • Observe Data good in Sharepoint MyListDev. We've successfully pointed to "SubmissionTimestamp" instead of "SubmissionDatetime"

SharepointList

  • FieldSettingMweFlow02. Go out of flow and back into edit (to ensure the UI is up to date). Observe
    • Through the UI "Create Item" parameters are as before
      • Parameters > SubmissionDatetime: [Blank]
      • Parameters > SubmissionTimestamp: utcNow()

Flow UI changes to Create Item

  • [Code View] however contains code that purports to populate "SubmissionDateTime" and not "SubmissionTimestamp" (nor for that matter "SubmissionDatetime", lower case "t")
      {
      "type": "OpenApiConnection",
      "inputs": {
        "parameters": {
          "dataset": "https://example.sharepoint.com/sites/MST_EXA_ExampleSite",
          "table": "some-guid",
          "item/CoolCountry": "MexicoDEV",
          "item/SubmissionDateTime": "@{utcNow()}"
        },
        "host": {
          "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline",
          "connection": "shared_sharepointonline",
          "operationId": "PostItem"
        }
      },
      "runAfter": {}
      }

Code view


Solution

  • In a sharepoint list:

    • The "Technical name" of the column will be different from the name we see in the UI, if we rename the column. This can cause the grief above.
    • To view the "Technical Name" there are two methods:
      • (Easiest): In Sharepoint sort the column and view the column name in the url. "&sortField=TechnicalNameOfColumn"; Or
      • Cog > List settings > Click on Column name: See column name in the url as "&Field=TechnicalNameOfColumn"
    • To solve:
      • Avoid renaming a sharepoint list column if possible.
      • If renaming is necessary: Create a new column with desired name. To achieve this, this might involve:
        • copying data from old column to an intermediate column
        • deleting the old column
        • creating the new column
        • copying from the intermediate column
        • deleting the intermediate column.