kelliganp
Workflow Hero

Re: Can You Cancel a Pending Workflow Task?

Ok... I tried to model this part where I captured the task ID in the "Store Task ID" variable. It did not work as the variable did not populate until I responded to the task that the flexi task action was exited.

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: Can You Cancel a Pending Workflow Task?

That is exactly the reason. This is why I suggested the option with either querying tasks list for items with specific token in title or to query tasks list via SharePoint rest API and then filter out only records having Id of current record under related items.

Reply
kelliganp
Workflow Hero

Re: Can You Cancel a Pending Workflow Task?

Hi @TomaszPoszytek, I have been workign on this and I was able to get a return with the URL formation you gave me. My web request returned the following XML:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xml:base="https://vector.leidos.com/ASP/dev/nintex/_api/">
   <id>00103ac2-af71-4289-8775-bdd8ffe59d05</id>
   <title />
   <updated>2020-01-23T21:36:46Z</updated>
   <entry m:etag="&quot;3&quot;">
      <id>13352afc-ebb0-4bca-9709-0e9d72ffd062</id>
      <category term="SP.Data.Workflow_x0020_TasksListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
      <link rel="edit" href="Web/Lists(guid'c00c8d5a-a195-4b25-81d0-e88152b550bc')/Items(3)" />
      <title />
      <updated>2020-01-23T21:36:46Z</updated>
      <author>
         <name />
      </author>
      <content type="application/xml">
         <m:properties>
            <d:Id m:type="Edm.Int32">3</d:Id>
            <d:RelatedItems m:null="true" />
            <d:ID m:type="Edm.Int32">3</d:ID>
         </m:properties>
      </content>
   </entry>
   <entry m:etag="&quot;1&quot;">
      <id>b2b1bc9e-2ef1-4c7f-a8e6-7dc58fcf8988</id>
      <category term="SP.Data.Workflow_x0020_TasksListItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
      <link rel="edit" href="Web/Lists(guid'c00c8d5a-a195-4b25-81d0-e88152b550bc')/Items(4)" />
      <title />
      <updated>2020-01-23T21:36:46Z</updated>
      <author>
         <name />
      </author>
      <content type="application/xml">
         <m:properties>
            <d:Id m:type="Edm.Int32">4</d:Id>
            <d:RelatedItems m:null="true" />
            <d:ID m:type="Edm.Int32">4</d:ID>
         </m:properties>
      </content>
   </entry>
</feed>

How do I use <m:properties><d:Id m:type="Edm.Int32">4</d:Id><d:RelatedItems m:null="true" /> <d:ID m:type="Edm.Int32">4</d:ID></m:properties>? In the case of this specific Item, the task I want to get to is "4" but I am still unclear on how to identify it from the other tasks in the list.

 

It is important to note that when I use this in production, the workflows will have several flexi tasks in them and will run on state machines so a given task may need to run more than once if the user is asked to edit and resubmit his/her request.

 

Thoughts?

Thanks,

Patrick

0 Kudos
Reply
TomaszPoszytek
Automation Master
Automation Master

Re: Can You Cancel a Pending Workflow Task?

In that example data under <d:RelatedItems m:null="true" /> is null. So it seems that these tasks were not created keeping the relation to original item. If this is the case, that for some reason task generated for your items are not in relation, then either you have to add something identifying to their title and use that to query list, or use the web service @cassymfreeman mentioned, what for on-premise should be the best idea 🙂

Reply
kelliganp
Workflow Hero

Re: Can You Cancel a Pending Workflow Task?

Thanks @TomaszPoszytek. Naming might be tricky unless I use some invrementing variable as the tasks can be reused. I put a 5 minute pasue before the web request just to make sure it did not out-run the felxi task as well. I will keep thinking about this but start modeling the @cassymfreeman  suggestion. Could you take a look at my questions to Cassy and see if you have any thoughts? She has not been able to respond yet.

 

Thanks to you both!!

Patrick

0 Kudos
Reply
kelliganp
Workflow Hero

Re: Can You Cancel a Pending Workflow Task?

Hi @TomaszPoszytek and @cassymfreeman,

I am working on Cassy's suggestion and have some results from a test. My screen shots below show what I am trying...

First I have the layout on canvas that I am using.

001 Layout.png My Web request configuation is as follows...

002 Config.png

Note: I put the value 6 in the taskID for testing purposes as that was the anticipated item id of the next task in this site's task list.

Here is the request XML used in the most recent test...

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:nin="http://nintex.com">
   <soap:Header/>
   <soap:Body>
      <nin:ProcessFlexiTaskResponse2>
         <nin:comments>This workflow was aborted due to outside cancellation.</nin:comments>
         <nin:outcome>Approve</nin:outcome>
         <nin:spTaskId>6</nin:spTaskId>
         <nin:taskListName>Workflow Tasks</nin:taskListName>
      </nin:ProcessFlexiTaskResponse2>
   </soap:Body>
</soap:Envelope>

Below is the results when the web request triggered (from verbose logging)

var_HTTPStatus_TXT: 302

var_ResponseHeaders_COL:

X-SharePointHealthScore=0;
SPRequestGuid=e5b02e9f-8841-b0b4-a2b2-c51469340b0b;
request-id=e5b02e9f-8841-b0b4-a2b2-c51469340b0b;
X-FRAME-OPTIONS=SAMEORIGIN;
SPRequestDuration=329;
SPIisLatency=0;
Persistent-Auth=true;
MicrosoftSharePointTeamServices=16.0.0.4936;
X-Content-Type-Options=nosniff;
X-MS-InvokeApp=1;
RequireReadOnly;
Connection=close;
Content-Length=198;
Content-Type=text/html;
charset=UTF-8;Date=Fri, 24 Jan 2020 18:47:33 GMT;
Location=https://vector.leidos.com/ASP/dev/nintex/Lists/Workflow Tasks/AllItems.aspx;
Server=Microsoft-IIS/8.5;
X-Powered-By=ASP.NET;

var_WebRequestOutcome_MLT:

<head>
<title>Document Moved</title>
</head>
 <body><h1>Object Moved</h1>This document may be found
 <a HREF="https://*****.*****.com/ASP/dev/nintex/Lists/Workflow Tasks/AllItems.aspx">here</a>
</body>

After the web request triggered, the flexi task remained in a pending status (Outcome).

Should the web request have updated the flexi taks outcome in my case to Approve?

 

Thanks and Regards,

Patrick

0 Kudos
Reply