Had a very interesting issue with a client’s environment recently. There was one user (let’s call her Jane) who couldn’t complete tasks. They would appear in her task list and she could action them without any errors, but it just looked like nothing was happening and the task would just sit there until someone else completed the task.
It turns out the error was in the database, but it’s tricky to see the problem. I ran the following query:
SELECT TOP 1000 [ID]
where ActionerName like '%Jane%'
The results looked fine, but exporting the results to csv and opening them in Notepad revealed the problem. I expected this:
But what I got was this:
Notice the ‘_’s? That’s actually a massive amount of whitespace after the user’s name. That’s what caused the issue. I trimmed the username and suddenly the problem went away. Here’s the script to fix all the entries (Thanks Mieke):
set [ActionerName] = RTRIM([ActionerName])
So what caused it? Here’s a response from K2 support (who were very helpful as always):
Values are written to the Actioners table based on the Destination Users set in a WF . Every User/Group/Role or value ever used as a Destination will show up in this table . Effectively , any user that get’s authenticated by the server …
The problem comes in at the point where Destinations are assigned . In cases where Destinations are assigned dynamically via DataFields who’s values are derived from outside sources (Drop Downs , User Input and so on) … If a value was copy/pasted into a Input Field that will then be used as the Destination , then this value will end up in the Actioners Table as is (UTF characters and all) .
In most cases this is why these spaces are introduced … Erroneous User Input which eventually filters down to the DB level but is pretty much invisible from any UI elements due to SQL and most of the Web Interface’s Auto-Trimming actions .
In very rare cases I have found that the spaces come directly from AD , where the AD Object was created using PowerShell and the inputs for the User Details copy/pasted from some sort of Rich Text Document containing UTF characters … However in your case the former appears more likely . Check where the Destinations User’s for your Workflows are derived from and ensure that there are no occurrences where Users can copy/paste values for Destinations … or if that is unavoidable , make sure to TRIM values before submitting to the K2 Server .