Forum Discussion

jamar's avatar
jamar
Ideator III
9 years ago

Deleting or changing assignments on a workflow

Hello, Is it possible to change the assignments on a workflow task through a method? The code I'm using is below, but it doesn't seem to delete the assignment. The reason being is that we bounce an ECO between "draft Changes" and "Peer Review" steps. We have the draft changes set as a default person, and the peer review set as "owner". Once the task goes to and leaves peer review, and the owner of the ECO is changed to someone else, the workflow keeps the original person not the updated one. We use  auto assignments which deletes assignments with a role (below code), but the "owner" assignment has no role and I cant work out how to flip it for a role. I tried "trl_role IS NOT NULL" but that didn't seem to do anything. I assume closed_on IS NULL means the task for that assignee is open, but it should close that active task when voting and create a new task everytime it goes to that step, so closed_on will always be null I don't know what the source_id = '{0}' bit means //Delete current assignments With a Role String DeleteAssignment = " SELECT ID FROM innovator.ACTIVITY_ASSIGNMENT WHERE SOURCE_ID = '{0}' AND trl_role IS NULL AND closed_on IS NULL"; this.getInnovator().applySQL(String.Format(DeleteAssignment,this.getID())); Item myDeleteRes = this.getInnovator().applySQL(String.Format(DeleteAssignment,this.getID())); for ( var icount = 0 ; icount < myDeleteRes.getItemCount() ; icount++){ Item assignment = this.newItem("Activity Assignment","delete"); assignment.setID(myDeleteRes.getItemByIndex(icount).getProperty("id")); assignment.apply()   Thanks in advance

3 Replies

  • Hi jamar, I'd have to review the workflow process datamodel. I believe the workflow process should be locked to be updated.
  • Jamar, Did you ever get this resolved? I seem to be having  the same issue. Tom
  • jamar's avatar
    jamar
    Ideator III
    No never resolved, decided to go down a different route. James