skip to Main Content

I have created a Power Automate flow to capture changes on a SharePoint List:

enter image description here

Here’s the body response I get from the wiql query:

enter image description here

To update the work item if exists, I need to work item ID.
To get that I used :

          @{body('Check_if_work_item_exists')['workItems'][0]['id']}

It returns "5648n"

and here’s the parameters it sending to update the work item ID:

            {
                "account": "MyOrgName",
                     "id": "5648n",
                "project": "MyProjName",
         "workItem/title": "test test test 88",
   "workItem/description": "<p>It's a test for devops integration 88</p>",
                   "type": "User Story"
            }
               

The error I am getting:

             <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 
             4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
             <HTML><HEAD><TITLE>Bad Request</TITLE>
             <META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"> 
             </HEAD>
             <BODY><h2>Bad Request - Invalid URL</h2>
             <hr><p>HTTP Error 400. The request URL is invalid.</p>
             </BODY></HTML>

2

Answers


  1. Chosen as BEST ANSWER

    As a workaround I added an Initialize a variable before condition to set the work Item ID if exist : This works fine, but will leave this question open in case someone came up with a better answer.

    If(empty(body('Check_if_work_item_exists')['workItems']),1,body('Check_if_work_item_exists')['workItems'][0]['id'])
    

    enter image description here


  2. Test the step to update a work item and it works fine:

    enter image description here

    The only difference is the ID. According to the error message, the request URL is invalid. It should be caused by the work item id "5648n".

    Can not see your workflow settings, however you need to find a way to retrieve the correct work item id. In your scenario, it should be "5648" but not "5648n".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search