Is there any way to correct the element order in a workflow? I have seen some really bizarre behavior.
I have a workflow that will resize a VMDK, and then go into the OS and resize the disk as well. This has worked in the past using a "Run command in guest" command, I just set up a powershell script, and then execute the script as a scriptblock parameter to powershell.exe as the program. But, with UAC, this wasn't working so well, and I couldn't get Powershell to elevate for me. So I switched to using a PowershellHost, and running the script as an external command
When I did this, I had done some testing by building a new workflow, testing the OS layer disk extension there, and then when I was happy with it, I copied the elements into the existing workflow, removed the run program in guest pieces, and dragged these into place, updated parameters, etc. I thought it would work, but it started doing some weird looping. It would get to the first element that I had newly copied in, and then it would start the workflow back over from the beginning. I looked at everything closely, and couldn't find an issue.
Eventually, I found that if I went into version history, and did a "diff against current version" from an older version, I would see that the success path of this element led back to the first step in the workflow. That wasn't how it showed on the schema pane, and if I selected the element, the "next step" was the step I expected.
I ended up reverting to that version, and when I did, the messed up workflow showed up on the schema pane as well, so I was able to fix it. But I still had problems - now the workflow won't run at all.
I selected the "start workflow" element in the schema pane, and looked at the ID column. I found that the last step in the workflow (the End step) was marked as item0. It seems that this step being item0, despite that it was at the end of the workflow, and not the beginning, was causing it to use the end of the script as an entry point. I created a new end step, re-pointed everything and deleted the existing one. But examining the ID column, the first step was still showing as item3, with two items that come some time after it showing as items 1 and 2. I deleted and recreated those steps - and now my first element is item3, and still my lowest numbered item - but when I run the workflow, its like nothing happens. I really don't understand why this is.
I'm wondering if anyone knows a way of re-ordering the workflow items to ensure appropriate flow.