Get Task History and display on your form.

  • 24 December 2014
  • 28 replies
  • 339 views

Userlevel 7
Badge +11

Here is a little Holiday treat for everyone.. The Nintex Web Service I still believe is a little golden nugget rarely utilised.. I was presented this issue the other day from a prospective customer, and I thought  "yeah I can do that"

 

The idea was that in Nintex Forms the customer wanted to display the workflow audit history. EG

Display Name Activity Title Outcome Start End User Comments
Dan Stoll Assign Flexi Task Pending 3:40 PM 23/12/2014    
Eileen Tan Assign a Flexi task Completed 3:39 PM 23/12/2014 3:40 PM 23/12/2014 (Eileen Tan) testing

 

Inside the form.

So without waffling to much here is a screenshot of the UDA and please find attached at the bottom.

The main element is calling the Nintex Webservice method 'GetWorkflowHistoryForListItem' . and then using the 'Call Web Service' action to drill into the XML results to pull the information you need into Collection Variables.

Once you have all this info you can use the same technique as you do to build a nicely formatted table for emails as posted here Formatting Results to an Email‌ .

 

The final result looks a little like this when the output of the UDA is set to a Rich Text box and then connected as a label in Nintex Forms.

 

Please note that the Webservice call action will require the correct credentials added.

 

Happy Holidays.


28 replies

Badge +11

Great tidbit!

Badge +7

Thanks, I'm new to Nintex so these technical blogs are brilliant!

I do have a question though, I've created the UDA successfully (and I finally understand collection operation actions), but I'm not sure how to get the results displayed on a form. You mention sending the UDA output to a rich text control and connecting as a label but I'm not sure how to get this working. Any tips appreciated!

Userlevel 5
Badge +12

Nicely done

Badge +2

Clever!

Badge +8

I created a rich text field on the SharePoint list, then sent the results from the UDA to a workflow variable, then used a "set field value" action in the workflow to set the rich text box to the value of the workflow variable and that worked.

Badge +2

Hey Dan! I've used this UDA time and time again...love it!!! One question, what if I wanted to sort the tasks oldest to newest? Would a sort Collection Operation on the user start date right before the For Each straighten it out?

Thanks!!!

Amy

Userlevel 7
Badge +11

Hey Amy Williford

Just thinking off the top of my head.. I don't think it needs to be that complex.. If you look at the last build string action where the table is being compiled, you will notice that the Build string variable value is actually inside the content .. So if you change the order

Instead of :

{BuildStringVarValue}

<tr><td>.....</td></tr>

make it

<tr><td>.....</td></tr>

{BuildStringVarValue}

By doing this , when the loop goes around and grabs the values, it will add the values to the table at the bottom and not at the top.

Makes sense ??

Badge +2

Dan Stoll

That makes perfect sense!!! Always trying to make things more difficult for myself! I will give it a whirl!

Thanks so much!!!

Amy

Badge +9

Great! Just seen here and I have a use case.

Manfred

Userlevel 6
Badge +16

Hi Dan Stoll​ . The task audit table says that "Eileen Tan" 's outcome was "Custom" and in your sample it seems to be Completed.

What does it mean "Custom"?

Userlevel 7
Badge +11

While I'm visiting this post.. If you are using a Flexi Task you will probably note that the /Outcome node sends back a value of Custom..

To actually get the "Real" outcome, change the UDA to point to the /CustomOutcome XML node, and not Outcome.

To get even more info into your history table, goto the  If you go into the Webservice call and do the test thing

In the web service call manually change the List item ID and hit execute .. it will give you the output of all the values available to you..

Badge +3

Hi Dan,

I am not sure to understand what is expected in the input parameter "Workflow Name"?

Could you please give me more details?

Thanks a lot!

Trish

Badge +8

Hi Patricia,

Without having looked at the UDA, I expect it to be the name of the workflow you want to have the history information from. So, for example, if you have a workflow called 'Approval', then that name should be inserted.

Cheers,

Rick

Badge +3

Thanks Rick it works!!

Cheers

Trish

Hello

We used Nintex in our Business since a few month. Your Post is exactly was I search, but i can't open the UDA-File. How can I use it?

Sorry for my english, this is not my strength.

Thanx for a short answer a greets from Switzerlang

Martin

Badge +3

Hi,

Can anyone help me?

We get this error when workflow run the web service : Failed to invoke web service. Error returned from server: 401 UNAUTHORIZED

Thank you.

Userlevel 5
Badge +14

the account that invoked web service call simply does not have sufficient permissions to do so.

Badge +3

Hi ,

I use admin account to run this.

Thank you.

Userlevel 7
Badge +17

Check if you have "Workflows can use app permission" site level feature active.

Regards,

Tomasz

Badge +3

Hi ‌ ,

Do you get to sort the task from oldest to newest?

Badge +3

Thanks Tomasz!

It works in our production but didn't work in our development environment. Need to further check later.

Userlevel 7
Badge +11

Hey Martin, sorry just seeing this for the first time.. the one thing with UDAs is that you have to import it as a UDA. Are you trying to do that or as a workflow ? EG, don't create a new UDA and then try to import it. 

Hi Dan. Thanks for your answer. I have found the solution in the meantime and it works fine.

Cheers,

Martin

Badge +3

Great post Dan Stoll and exactly what I am looking. Unfortunately, our company has limited the access to the Webcall Service. So we always receive an error message when importing the UDA. Besides the fact, that only the IT department has access to UDA... 

Does anyone no a different blog post who deals with this topic? I am not very confident to implement this with collection variable myself, but I would love to have this implemented in my form.

Big thanks in advance!

Badge +7

I have thought of doing this so many times and sending reminders to users about all open tasks...but never started.  Thanks Dan... all the work is done  now I can just copy and implement.

Reply