Post

1 follower Follow
1
Avatar

Determine if task exists and add dependency

I’m trying to write a custom action that adds tasks and creates dependencies based on whether tasks with a certain name exist.

 

Task name

  • Produce
  • Review (depends on Produce)
  • Get Approval (Depends on Review)
  • Schedule (Depends on Get Approval)

 

I would like the action to add a similar group of tasks and utilize one that already exists like so:

 

Task name

  • Produce
  • Review (depends on Produce just added)
  • Schedule (Depends on EXISTING Get Approval)

 

I’ve set this to run on $WorkItems and filter related items using In(TargetObject.Name,"Approval").  If true, a new Dependency object is created.  Everything works up to that point, the new tasks are created, the dependency is created between the new sub-tasks,  (Produce and Review), but the dependency between the new Review task and the existing Get Approval task isn’t being created.

Candice Bell Answered

Please sign in to leave a comment.

5 comments

0
Avatar

Hi Candice,

 

Can you please share a screenshot of the workflow rule?

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Couldn't get the entire thing on 1 screen, sorry for the multiples.

Candice Bell 0 votes
Comment actions Permalink
0
Avatar

Hi Candice,

 

Can you try change the In() function to Contains() ?

 

Thanks,

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

Perfect!  That change and switching the $WorkItem and $Depends on objects has it working now.  Thanks!!

Candice Bell 0 votes
Comment actions Permalink
0
Avatar

Perfect!

Please notice that In() function searches for an exact match and this is the reason it wasn't working.

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink