Solved

Problem with variables when trying to build custom history


I have built a workflow that is fundamentally an approval for overtime hours. The list is driven by a Nintex form that contains a repeating section to capture the various entries for a period of a month. That all works well, but I have a problem with capturing the history into the same list. This is because our payroll teams need visibility of an audit trail.

To achieve this, at regular points in the process, I have actions that initially retrieve history for that item, from the list column (I called it GenFormHist), which is then added to a multi-line variable varHistory. During the course of the workflow, I read, append and update that column through the same actions, also logging to the Nintex history list as well (which I believe is volatile - max 90 days?)

What seems to be happening, is that the initial history entry, when the form is first submitted in a status of New, I simply write a "New item" entry to the history column, then store that into the varHistory variable. The next actions include a condition, to see if the form has a confirmation checkbox set. If not, the form is set to a status of Draft. If true, then the status is changed to Pending.

In the draft scenario, having passed the condition and been routed through the "no" outcome, there is another set of history column read, append and write actions to record that the form has been saved as draft. On that outcome leg, the workflow then ends. 

My problem seems to be that the initial entry, the New Item entry, gets lost and does not show in the overall history. Is there something that passing through a condition switch does to the variable values? Do they get blanked or is this down to my poor workflow design - be honest!

Here are the actions concerned:

   23064i6F14A632A9980E15.png

23065i9763E97E9DF7303E.png

23066i1C11B6719FAEF7D3.png

This is what is added in the initial history item creation:

23068i7445CB9910FD081E.png

Here is the configuration of the Query List action:

23067i38282C7F80B10627.png

Finally, the Update item action:

23069i5B861D361C1DBCE9.png

Any help, most welcome.

Thanks, Pete.

 

 

 

icon

Best answer by MegaJerk 27 May 2022, 06:56

View original

5 replies

Userlevel 5
Badge +14

What does the second varHistory variable update look like (as in the contents of the Set Variable action for instances beyond the first one that is set when GenFormStatus === "New")?


 


 

Hi, sorry for the late response, I have been on leave for a week. So, the second varHistory update looks like this in the config:



 


 

Userlevel 5
Badge +14

There doesn't really appear to be anything wrong with your procedure, or at least what I see of it. 


 



  • Populating varHistory with an initial value


 



  • Updating the Column with varHistory


 



  • Retrieving the value of the Column and using it to set varHistory's value


 



  • Updating varHistory with *some value* + varHistory 


 



  • Updating the Column with varHistory 


 


all seem like standard straight forward and correct things. Without taking a look at the workflow in question, it is difficult to tell where the problem lay. I would recommend doing a mockup test workflow that follows the general flow but just updates a variable and the column in question with arbitrary data to see if you can't sort out what's going on. If your mockup works then at least you know that something else isn't broken and perhaps it's just an oversite in either how something is being set or an unexpected branch being taken in the workflow. 

Thanks @mega I basically did what you suggested and stripped everything out, then added them back in. It worked from that point. I can only assume that I got a value slightly wrong or the action itself was damaged in some way. I have seen evidence of that before. Many thanks.

Userlevel 5
Badge +14

We've all been down the tiresome road of something appearing correct, but not working correctly. I'm glad that you got it working!

Reply