Reopen workflow tasks if previous tasks change

jimnicholson
Giga Guru

Hey All,

New to SN, hoping you may be able to help out here.   I have a workflow that generates about 15 tasks after approval.   These tasks need to be completed in order so I have all sorts of protection around them not allowing them to be edited until it's "the tasks turn."  

The item I am stuck on, for example:

Task 1:   Closed Complete

Task 2:   Closed Complete

Task 3:   Open

Task 4:   Pending

etc...

I have created a UI Action at the task level to allow tasks that have been previously closed to be reopened (the only way they can edit these tasks is to click this button)   So when a user hits "Reopen Task" the task state is now set to Open, and they can change information.   Let's say this happens in task 1, I need a way to when they close this task again, to reopen task 2 to an "Open" state, and put Task 3 in pending.   If task 2 were to be reopened, and modified, and then closed again, task 3 would be need to be reopened after.

Essentially, I need to restart the workflow right after the point where the data changed.   Information changing in a previous task could directly impact the subsequent tasks but would never impact the previous.   This wouldn't be so difficult for me if it was just reinitializing the workflow or rolling it back, but with so many variable roll back points, it becomes trickier for me.   Also, this is a custom built app, so it's nothing like change, incident, problem, that would be out of the box.

Any ideas?   Certainly happy to post, email, etc... any information you would find helpful.

Thanks very much!

Jim

6 REPLIES 6

None of my code would do that; it sounds like you're fighting a bad business rule.


Turn on "Debug Business Rules (details)" and it will log out any field value changes, so look for "state" changing.



The other place to look would be a default value or override, but if you tried explicitly setting the value (not the label!), that shouldn't be it.


So it was something I had wrong in the Wait for, honestly, it was that when I copied your code for the rollback, it copied the line numbers as well, so it was always true and just rolling back.   So here is where I'm at.   I've added all the if scripts before the task creation, and if this flow works without a reopen, it works perfectly.   The issue is still with the rollback for some reason and I don't know why.   What is happening now, is that if I reopen (checking the checkbox with my UI Action now) it definitely see's that something has happened and attempts to rollback.   It's when the rollback occurs that the functionality is a bit messed up.   If I reopen task 2 of 15, modify it, and then flag it "closed complete", the rollback occurs, and then marks the PREVIOUS task as "pending" (Task 1), along with task 2 as "pending" as well, and then all the tasks following (3-15)   are marked as "Closed Incomplete" now.   I need just the opposite of what is happening to occur.   Task 1 remains untouched, task 2 can be closed complete since it was the one modified, and all the following tasks, 3-15, should be reopened.   I'm still messing around with it but haven't had much luck, I'm definitely further than I have been, so that's a plus.