Delete is a Form of Edit

imageIt’s summer, and despite the serious pile of work to be done and serious blog posts to be written, I’m finding more evenings filled with old movies, old songs, and old episodes of favorite shows. Unfortunately, due to that serious pile of work, the various threads get crossed. So, when I found myself in a meeting making the statement expressed in the title, I knew I was having an Office Space moment.

“I must have put a decimal point in the wrong place or something. I always do that. I always mess up some mundane detail.”

Oh! Well, this is not a mundane detail, Michael!”

If you say something like that, you’re either trying to avoid doing something that is difficult or you’re trying to avoid admitting having done something stupid. In my case, as of Friday afternoon, I was trying to avoid a difficult thing that might result in my doing something stupid.

I spent some time last week working on a series of workflows to delete entries in a payables process that we wired up in SharePoint. The problem with payables is that they have to be allocated and any one payable entry (invoice) can be allocated across several accounts. All of the allocations have to be deleted before the payable item can be deleted The inability to iterate over a list in SharePoint 2010 makes that impossible without a Rube Goldberg-type solution involving multiple shadow lists that allow you to work around the “a workflow can’t do anything that would cause itself to start” limitation. Fortunately, Nintex workflows can handle this limitation quite well.

In the case of ‘delete’ I have a simple workflow that checks to see that a payable item can be deleted (has been submitted but hasn’t been approved) and can delete payable items and the related allocation items. “Can” being the operative word – for now, the workflow is simply updating a text field with the string “this item would be deleted.” That’s a safe way to start, because I don’t have the luxury of a test environment with Nintex workflows running in it. I’m changing breakers with the power on, as it were. If I make a mistake, I could do some damage.

After I deploy the delete workflow, I have to modify it to create a delete workflow that the accountants can run even after a payable has been approved. After that, we need one final version that can delete an item even after the accountants have approved it. We are serious about not accidentally paying someone. Still, all forms of delete are just variations on a theme. The only differences are that some stop in the presence of a specific status flag and some don’t. After I get all the delete options working, I have to create an ‘edit payable’ option.

Deleting a payable is easy compared to preparing a payable for edit.

Preparing for editing requires making a payable entry, and its associated allocation entries look like they are at the point before they were submitted, or perhaps the point before they were approved or perhaps the point before they were cleared for payment. Since the approval process can involve multiple people, the items involved get quite messy. There are several workflows involved and they all set some value(s) and they all read some value(s) and they all work or don’t work based on those values. Get one value wrong and, if you’re lucky, something isn’t going to work. If you’re not lucky, you end up singing along with Jerry Lee Lewis “…she rolls but she don’t roll right.”

Michael Bolton (in Office Space, not the singer) and Jerry Lee hint at those mundane details causing problems, but John-Luc Picard encounters them directly. One of my favorite Star Trek Next Generation episodes is “Clues” and it’s based on the complexity of undoing the past to a point where you could start over. The episode involves a chance encounter with an alien race – a powerful alien race who would rather destroy the Enterprise than have the universe know that they exist.

As I crawl through the various workflows, looking for all the status indicators, I realize that resetting the status to a prior point is way harder than deleting it. I can see why those aliens would have been happy just deleting the Enterprise.

I decided to wait until Monday to wire up the delete option. In the meantime, I’ve been studying how to reset the items for editing and I think I’ll watch “Clues” this weekend.

I hope your summer is going well.

One thought on “Delete is a Form of Edit

  1. Picture – There no way that barn is going to be made to look like nothing happened. A new barn is in order. Sometimes, that’s what we have to do – delete and start over.

Comments are closed.