First of all do not delete any workflow template with running instances in a production system. even inactive workflow templates which had been active once should not be deleted. Well, you might say: “I don’t need this workflow any more, I have made a new template which works much better or has a completely new logic and I don’t what to be confused by the old one”.

The problem is that although the workflow system has a very good version management and every time you transfer a workflow template to your production (or QA) system a new version is automatically created, once you delete the workflow template,it doesn’t work and the system handles the workflow like it never existed. Any active workitems will be stuck (not immediately but when a user does something with them) and a restart after error will simply not work because of the missing workflow template.

What can you do to solve this if it happens? well you must create a new workflow template with the same number as the deleted one, even an empty one will do, once you transfer the workflow template, the version management will resume like this is a new version of the deleted workflow and all the old versions will now reappear.

In order to do so you need to reset the workflow number range:

Go to transaction SNRO the workflow template number range is HRSOBJECT,

/wp-content/uploads/2014/02/snro_384404.png

Standard object type is WS, change the status of the number range,

/wp-content/uploads/2014/02/snro_ws_384405.png

Change the current number so the next template to be created will be with the same number of the one that was deleted.

/wp-content/uploads/2014/02/snro_ws_number_384406.png

You might want to remember the current number so you can return it to where is was after you recreated the missing workflow.


There is one more thing you need to do, although the template itself can be empty, the workflow container elements must me restored (same name, same type), since the version management doesn’t work for the container as well. this might be a bit more difficult, but you can use the older versions help you do so by

using the import/export to xml option (Workflow->import/export->Export to XML File in the workflow builder)  to transfer the missing container elements back to the development system (QA->DEV).


This behavior of the system also means that it’s a bad idea to ‘only’ delete container elements of active workflows as well, since older version will stop working even if you didn’t delete the workflow template. If you did delete a container element, simply recreate it and the older versions will work again.


To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

  1. Karin Lund

    Hi Ronen

    Very nice article.

    I currently have a requirement to ‘clean up’ old workflow templates and tasks that are no longer in use.

    My first impulse is to make sure that no instances are running anymore in the productive system, and then just delete the templates and tasks.

    But reading your article, I get the impression that you would NOT recommend deletion. Can you elaborate a bit more on why not? What are the consequenses?

    Regards,

    Karin.

    (0) 
    1. Ronen Weisz Post author

      Hi Karin,

      Thank you and you are correct, I would not recommend deletion.

      First of all any active workflows will go into error once a user tries to do anything.

      But let’s say that you made sure that there are no active instances before you delete the template, the problem is that the template will not exist in the system, it will not be ‘marked for deletion’ or in a ‘deleted’ status and you will not be able to see old versions of the workflow.

      So if for some reason you will need to analyze an instance of the deleted workflow, logs will still be seen (or at least they where seen in my system) but you will not be able to see the workflow template.

      Delete only if there were no instances of the workflow template in or if they were not of any importance to the organization.

      Best regards,

      Ronen

      (0) 
      1. Karin Lund

        Thank you for your swift reply!

        I’ll talk to the organization to verify that they do not need the drill-down options to view tasks or templates from the old workflow logs.

        BR,

        Karin.

        (0) 
    2. Rick Bakker

      Hi Karin,

      I currently have a requirement to ‘clean up’ old workflow templates and tasks that are no longer in use.

      But why? What are they hoping to gain from this? It won’t save any space. Just put “OBSOLETE” in the description and you’re finished. I agree with Ronen – don’t delete.

      regards

      Rick

      (0) 
      1. Karin Lund

        Hi Rick

        Thank you for your input.

        The primary reason is transparency.

        The solution involves 30+ obsolete templates and 300+ obsolete tasks.

        All of these tasks and templates are in the same package and refers to the same BOR as the current running solution.

        So for reasons of transparency, it would be nice to have the obsolete objects filtred out when doing a ‘where-used’ for the BOR or when working in the package in SE80.

        regards,

        Karin.

        (0) 

Leave a Reply