<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Workflow API error 422- Unprocessable entity in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286867#M4604115</link>
    <description>&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;it is difficult to judge from looking at the screenshots. I still think it is quite likely that it is not the same user for both calls. Are you sure that the call that goes goes from the ABAP to workflow service isn't OAuth2 client-credentials based (i.e. using the service keys, not going via e. g. an approuter or Portal)? Technical users will usually never have real tasks or if they try to complete a task already reserved by a real user, they will "always" be different from the real user and get that error message.&lt;/P&gt;&lt;P&gt;If you can confirm it is the same user, I'd recommend opening a support ticket at LOD-BPM-WFS so that we can look at the data.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
    <pubDate>Mon, 05 Oct 2020 15:47:29 GMT</pubDate>
    <dc:creator>tobias_breyer</dc:creator>
    <dc:date>2020-10-05T15:47:29Z</dc:date>
    <item>
      <title>Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaq-p/12286862</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
  &lt;P&gt;I am using workflows API to start and complete workflows from ABAP code given in the link below through restful abap.&lt;/P&gt;
  &lt;P&gt;I am able to successfully Start and Close workflows via abap code to call workflow API. The problem comes up when one user claims the workflow from My inbox and tries to complete it, Same abap code gets called trying to complete the workflow. But the API call gives an error 422 saying the entity is unprocessable. If the user unclaims it, we are able to successfully complete the workflows. Any help would be really appreciated.&lt;/P&gt;
  &lt;P&gt;&lt;A href="https://blogs.sap.com/2019/07/09/leveraging-scp-neo-workflow-from-the-scp-abap-environment/comment-page-1/#comment-531634" target="test_blank"&gt;https://blogs.sap.com/2019/07/09/leveraging-scp-neo-workflow-from-the-scp-abap-environment/comment-page-1/#comment-531634&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 04:57:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaq-p/12286862</guid>
      <dc:creator>StarDev</dc:creator>
      <dc:date>2020-10-05T04:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286863#M4604111</link>
      <description>&lt;P&gt;Please check the response body of the call. It should contain more details. If assume, you use the PATCH task-instances API, so see the documentation:&lt;/P&gt;&lt;P&gt;&lt;A href="https://api.sap.com/api/SAP_CP_Workflow_CF/resource" target="test_blank"&gt;https://api.sap.com/api/SAP_CP_Workflow_CF/resource&lt;/A&gt; -&amp;gt; User Task Instances -&amp;gt; PATCH /v1/task-instances/{taskInstanceId} -&amp;gt; 422:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;The task cannot be updated for one of the following reasons:&lt;BR /&gt;
The values submitted for updating the property cannot be resolved or became&lt;BR /&gt;
invalid after resolution. The context provided in the request body contains&lt;BR /&gt;
prohibited fields or the status in the request body is invalid.&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Also check the example value.&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 07:06:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286863#M4604111</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-10-05T07:06:18Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286864#M4604112</link>
      <description>&lt;P&gt;Thanks Tobias for your comment.&lt;/P&gt;&lt;P&gt;.The Wf task has been claimed by user using the CLAIM button which calls the std service via this URI odata/tcm/Claim?SAP__Origin='NA'&amp;amp;InstanceID='0f385027-06e8-11eb-bd0f-eeee0a91f755'. I think this is setting the status to unprocessable.&lt;/P&gt;&lt;P&gt;When we try to Complete it after claiming this error comes up. The complete button has a PUT call to a custom odata entity. Inside the method we are calling the API PATCH to complete it .&lt;/P&gt;&lt;P&gt;If the task is not claimed, We are successfully able to complete the task without any problems. Even if we unclaim it and complete it, It goes fine and gives status as success.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847879-plpet.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 10:40:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286864#M4604112</guid>
      <dc:creator>StarDev</dc:creator>
      <dc:date>2020-10-05T10:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286865#M4604113</link>
      <description>&lt;P&gt;"Claiming" means reserving a task for processing by oneself so that no other recipient can see it and work on it. This avoids duplicated work. So receiving the 422 seems correct system behavior to me, if you cannot complete a task that has been claimed by another user.&lt;/P&gt;&lt;P&gt;It is not becoming clear whether the two calls are done by the same user. In fact, if you receive a 422 with an "already claimed", then maybe the call is not done with the user that has claimed the task. If you want to basically take away the task from that user, you have to unclaim it (could also be done with administrative APIs below task-instancees) and then complete the task by API.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 12:34:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286865#M4604113</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-10-05T12:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286866#M4604114</link>
      <description>&lt;P&gt;HI Tobias. Thanks for your commments.&lt;/P&gt;&lt;P&gt;Yeah its the same user&lt;/P&gt;&lt;P&gt;For example if i click on complete without claiming as shown below.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847890-fukrc.png" /&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://api.workflow-sap.cfapps.eu10.hana.ondemand.com/workflow-service/rest/v1/task-instances/b44a78c6-0711-11eb-bd0f-eeee0a91f755" target="test_blank"&gt;https://api.workflow-sap.cfapps.eu10.hana.ondemand.com/workflow-service/rest/v1/task-instances/b44a78c6-0711-11eb-bd0f-eeee0a91f755&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Output from response is&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847891-sl5j4.png" /&gt;
&lt;/P&gt;&lt;P&gt;Error case. Same user claims it and tries to complete it&lt;/P&gt;&lt;P&gt;&lt;A href="https://api.workflow-sap.cfapps.eu10.hana.ondemand.com/workflow-service/rest/v1/task-instances/10623026-06cb-11eb-bd0f-eeee0a91f755" target="test_blank"&gt;https://api.workflow-sap.cfapps.eu10.hana.ondemand.com/workflow-service/rest/v1/task-instances/10623026-06cb-11eb-bd0f-eeee0a91f755&lt;/A&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847893-jg855.png" /&gt;&lt;/P&gt;&lt;P&gt;I get error 422.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847892-hylbz.png" /&gt;Also i noticed when i claim it( on click of claim button) there is a std api call which changes the status to RESERVED.
&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847894-p65gr.png" /&gt;
&lt;/P&gt;&lt;P&gt;Something similiar happens when i unclaim ( Release ) it&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1847895-5ci4h.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 14:44:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286866#M4604114</guid>
      <dc:creator>StarDev</dc:creator>
      <dc:date>2020-10-05T14:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286867#M4604115</link>
      <description>&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;it is difficult to judge from looking at the screenshots. I still think it is quite likely that it is not the same user for both calls. Are you sure that the call that goes goes from the ABAP to workflow service isn't OAuth2 client-credentials based (i.e. using the service keys, not going via e. g. an approuter or Portal)? Technical users will usually never have real tasks or if they try to complete a task already reserved by a real user, they will "always" be different from the real user and get that error message.&lt;/P&gt;&lt;P&gt;If you can confirm it is the same user, I'd recommend opening a support ticket at LOD-BPM-WFS so that we can look at the data.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 15:47:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286867#M4604115</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-10-05T15:47:29Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286868#M4604116</link>
      <description>&lt;P&gt;Hi Tobias.&lt;/P&gt;&lt;P&gt;I think you are spot on !&lt;/P&gt;&lt;P&gt;Its getting created by technical user.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; and as a matter of fact its Oauth.&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" /&gt;&lt;/P&gt;&lt;P&gt;What should be done to fix this ? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Oct 2020 16:50:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286868#M4604116</guid>
      <dc:creator>StarDev</dc:creator>
      <dc:date>2020-10-05T16:50:30Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286869#M4604117</link>
      <description>&lt;P&gt;Hi Ravi,&lt;/P&gt;&lt;P&gt;it depends on how you integrate CP Workflow with the ABAP environment and what you want to achieve. Client-credentials is usually a "coded" way of calling the API. If the ABAP code itself was triggered from a web UI, I suppose it should be possible to use a token or session from there.&lt;/P&gt;&lt;P&gt;But I cannot help on how to use e. g. OAuth2SAMLBearer Assertion flow in the ABAP environment instead.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Tobias&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2020 10:26:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286869#M4604117</guid>
      <dc:creator>tobias_breyer</dc:creator>
      <dc:date>2020-10-06T10:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Workflow API error 422- Unprocessable entity</title>
      <link>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286870#M4604118</link>
      <description>&lt;P&gt;This got solved by two api calls. First call is done to change the approver name in the context. Second call to complete the workflow instance by passing status as COMPLETED.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 15:24:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/workflow-api-error-422-unprocessable-entity/qaa-p/12286870#M4604118</guid>
      <dc:creator>StarDev</dc:creator>
      <dc:date>2020-10-28T15:24:36Z</dc:date>
    </item>
  </channel>
</rss>

