Post

3 followers Follow
0
Avatar

Custom Action: Adding same resources as parent

I have a custom action that creates a new task underneath the current workitem selected by the user, and then set various fields to the correct values.

The one item I am struggling with is to add the same resources to the new task that exist on the parent task. I know I have to create these as new link objects which link the new Workitem to the Resources.

However, I'm struggling to work out how to get the list of resources from the parent workitem (as there may be more than 1 resource assigned to it). I thought the FindObject function may work, but it looks like it only returns one object even if there are multiple ones.

Any suggestions? Is there a better way to do this?

Andrew Miller Answered

Please sign in to leave a comment.

3 comments

0
Avatar

Hi Andrew,

 

What you need to do is use the Run On the existing resource and do the copy over. Please check the attached example, and let me know if you were able to make it work.

Good luck!

Tamir

Tamir Avital 0 votes
Comment actions Permalink
0
Avatar

This worked great. Not sure how, but it worked!

Just so its clear in my head: Because I've run it on $Resources, which is a link between a Task and a User, then it will create a new object for every Resource link?

Andrew Miller 0 votes
Comment actions Permalink
0
Avatar

Hi Andrew,

 

Because you Run On Resource it allows you to add each (TargetObject) as a resource to the newly created task. If you want  to get additional context and explanation, I would recommend to join one of our Advanced Configuration webinars - http://www.clarizen.com/live-demo.html 

 

Please let me know if you have any follow up questions!

 

Regards,

Tamir

Tamir Avital 0 votes
Comment actions Permalink