cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ChrisRomer
Frequent Visitor

Why is SharePoint 'Update Item' different between two flows?

I've got a number of flows that update a SharePoint list and recently added a date field to the mix. Sometimes the variable I pass to this date field in the Update Item action has a NULL value. Three jobs have no issue with this. I have a job to fix errors on the same list. It also uses Update Item, and crashes with the typical error "... is required to be of type 'String/date'. The runtime value '""' to be converted doesn't have the expected format 'String/date'."

If I look at the output for the flows that are working, they seem to ignore the null field.

 

Stranger, I used Peek Code to view both Update Items in Edit (not flow run output), and the underlying code is different. I appear to have two different Update Item (PatchItem) actions.

The Peek Code on the working one starts out:

 

{
    "inputs": {
        "host": {
            "connection": {
                "name": "@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_sharepointonline']['connectionId']"
            }
        },
        "method": "patch",
        "body": {

 

 

The Peek Code on the broken one starts out:

 

{
    "inputs": {
        "host": {
            "connectionName": "shared_sharepointonline",
            "operationId": "PatchItem",
            "apiId": "/providers/Microsoft.PowerApps/apis/shared_sharepointonline"
        },
        "parameters": {

 

 

Why did this happen, and how do I specify the version that works?

1 ACCEPTED SOLUTION

Accepted Solutions

I ran across this issue again on flows with null dates, and it was driving me crazy. I tried to copy the 'Update Item' that ignores nulls, but it disables the paste because it 'doesn't match the current flow schema'.

Fine, I started a new Flow with the working Update Item and copied over the rest of my flow. Here they are side by side. Same flow except the 'Update Item'.

 

  • Left flow uses"operationId""PatchItem" and fails on null
  • Right flow use"method""patch" and ignores null dates



ChrisRomer_0-1603396665989.png

 

View solution in original post

3 REPLIES 3
Hardesh15
Super User II
Super User II

@ChrisRomer 

 

You have to use condition which will check whether you date column has value or not. Use one condition action with following logic.

Date column is not equal to null.

When this column has value update your item.

 

Difference in update peak code is due to one which has value and return result and which does not have value so it is  sending you error message from api.

 

Thanks.

Hardesh

I do use a condition because I also am using formatDateTime, and that will error out on NULL. My point is that both the populated date and NULL variables will run through Update Item in those flows (it's the same variable passed to Update Item, which is not part of the branch logic). If I look at output, the successful flow is simply ignoring the NULL. In my other flow, which is the same list and Update Item, it will crash on NULL.

 

ChrisRomer_0-1602273393222.png

 

The code I shared is 'Peek Code' from Edit, not copied from job run output. The action doesn't know what value the variable will hold other than it will be a String.

 

Here is output. See SCMCERTDATE is blank, and is magically not used in the Output. No error.

ChrisRomer_0-1602274462087.png

 

I ran across this issue again on flows with null dates, and it was driving me crazy. I tried to copy the 'Update Item' that ignores nulls, but it disables the paste because it 'doesn't match the current flow schema'.

Fine, I started a new Flow with the working Update Item and copied over the rest of my flow. Here they are side by side. Same flow except the 'Update Item'.

 

  • Left flow uses"operationId""PatchItem" and fails on null
  • Right flow use"method""patch" and ignores null dates



ChrisRomer_0-1603396665989.png

 

View solution in original post

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

MSFTBizAppsLaunchEvent

Experience what’s next for Power Virtual Agents

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Users online (12,369)