cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate I
Advocate I

Update SharePoint Item - Resource Not Found

I have a Flow to process a Form, it creates an item in a SharePoint list for each response.  I've now amended it so that if a user submits another submission it updates the row for their existing response.

When I try and update the item in SharePoint I get an error from the Update Item step saying "Resource not found"

 

Error.png

 

I have a Get Item prior to the Update which works fine

 

FlowSegment.png

 

The Get Item is using an item ID from the Parse JSON step.  

 

Expanded.png

 

I have tried setting Update Item to use the same JSON generated ID field as well as the ID returned from the Get Item step and I get the same error.

I'm baffled, any help greatly appreciated

Andy

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Fixed it.

 

The issue was the Parse JSON which was creating an array, even if it only had a single member, so the Update Item step couldn't use it.  I have no idea why the Get Items could, and why i couldn't then use the returned item ID to Update.

 

I have used the prior Get Items stage and then used the expression

first(body('Get_previous_responses_for_user')?['value'])?['ID']

to get the ID, which I can then successfully use in the Update Item step 

View solution in original post

7 REPLIES 7
Highlighted
Dual Super User III
Dual Super User III

Check to make sure the ID that you are harvesting from the JSON isn't a string, I suspect it is.  The ID field needs to be an integer.  So I think you need to do something like this for using the ID field

int(dynamiccontentID)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted

Thanks for the quick response, I changed it as suggested to

 

int(body('Parse_JSON')?['ID'])

 

I got a different error this time,

"Unable to process template language expressions in action 'Update_item' inputs at line '1' and column '2860': 'The template language function 'int' was invoked with a parameter that is not valid. The value cannot be converted to the target type.'."

 

The thing that is really confusing me is why I can't seem to use the ID returned by the successful Get Item step

 

 

Highlighted
Dual Super User III
Dual Super User III

Can you show me the JSON schema for the parse JSON?  



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted

Here you are

{
  "type": "object",
  "properties": {
    "ItemInternalId": {
      "type": "string"
    },
    "ID": {
      "type": "integer"
    },
    "Title": {
      "type": "string"
    },
    "{Identifier}": {
      "type": "string"
    },
    "{IsFolder}": {
      "type": "boolean"
    },
    "{Thumbnail}": {
      "type": "object",
      "properties": {
        "Large": {},
        "Medium": {},
        "Small": {}
      }
    },
    "{Link}": {
      "type": "string"
    },
    "{Name}": {
      "type": "string"
    },
    "{FilenameWithExtension}": {
      "type": "string"
    },
    "{Path}": {
      "type": "string"
    },
    "{FullPath}": {
      "type": "string"
    },
    "{VersionNumber}": {
      "type": "string"
    },
    "@odata.etag": {
      "type": "string"
    }
  }
}

 

The JSON  itself comes from a prior Get Items that is filtered using Name eq 'YourName'

 

Now I look at it the JSON is obviously for an array, even though there's only one item in it.  However, the Get Item takes the ID from the Parse JSON and returns an item as you can see here.  So why can't I use that returned item to use the Update Item?

 

GEtItem.png

 

 

Highlighted

Fixed it.

 

The issue was the Parse JSON which was creating an array, even if it only had a single member, so the Update Item step couldn't use it.  I have no idea why the Get Items could, and why i couldn't then use the returned item ID to Update.

 

I have used the prior Get Items stage and then used the expression

first(body('Get_previous_responses_for_user')?['value'])?['ID']

to get the ID, which I can then successfully use in the Update Item step 

View solution in original post

Highlighted
Dual Super User III
Dual Super User III

Get Items always returns an array.  So if you only want one of the items you need to use a First() or run it through a loop and save the item as a variable.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Highlighted

There was a typo in my last post, should have been Get Item singular not plural

 

 I have no idea why the Get Item could, and why i couldn't then use the returned item ID to Update.

 

There is still no reason I can see that Get Item could return an item, but not be able to pass the ID onto an Update Item step to patch the record.  By the logic of the problem solution, Get Item should have failed as well, if it had done so it would have been obvious why.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (8,261)