It's all about the answers!

Ask a question

Is there a way to execute server-side logic on a work item save?

Andy Phillipson (10431418) | asked Nov 12 '12, 11:59 a.m.

I'd like to be able to create the following project area items on a successful work item save:

  • timeline
  • work item category
  • ategory/timeline assoc.
  • plan
  • team area

What's the best way to do this?  I guess the choices are:

  • Operations behaviors - not sure which "hook" is best
  • Attribute customization - I think this is only client side behavoir?
  • Process Advisors - How is the advisor related to the specific work item type/state?

I've this seen this  article - so I am really just asking about the approach at this point.

Accepted answer

permanent link
Ralph Schoon (63.2k33646) | answered Nov 13 '12, 3:03 a.m.
edited Nov 13 '12, 3:04 a.m.
Andy, please have a look at You are looking for a participant as described in the article (or the older version you refer to). I also try to blog about the API and you might find additional information here:

The choices are: Advisor (pre-condition), Participant (follow up action).

Attribute customization using scripts does not give you enough API to do what you want.
Please be aware that you will likely have to use internal API e.g. for creating plans.

Advisors and Participants run upon save. It is your task to find out if the extension has to do something.
Andy Phillipson selected this answer as the correct answer

2 other answers

permanent link
Andy Phillipson (10431418) | answered Nov 14 '12, 12:20 p.m.
 Hi Ralph,

Great blog! I'll definitely checkout Plugin Spy.  In fact, most of my questions are around finding the correct class API for what we'd like to do.  So, based on the things I'd like to automate as described in my OP ... do you have any additional pointers (for examples ;-) ?  Someone needs to write a Redbook on Jazz Extensibility with a complete API reference :-)

I see in your blog that a participant "can fail and roll back the save, but does not have to".  I assume this refers to the work item save.  One of the concerns I have is that I need to make sure that all of the operations complete (per my OP list of stuff to so on a save).  If any single item fails I need to roll back (or undo) everything (if that's possible).

Another item:

Is it possible to create work items in another project area (B) on a work item save in this project area (A)?  I'd like to be able to do this and create links between the work items.

Thanks again,

permanent link
Ralph Schoon (63.2k33646) | answered Nov 16 '12, 5:03 a.m.
Hi Andy,

you can search the forum for API examples. A lot of people have done extensions and there are a lot of examples in pots. A Redbook would be nice, but I think it is futile since the API will change and it would take all the fun out of finding stuff yourself 8-). And, who has the time to do all the work?

I would be interested what the use case is in your case. I have some concerns to do all that in a follow up action. One reason is permissions. The operations you run in the participant use the user, roles and permissions of the user that is currently running the operation. To create all the artifacts, every user that is supposed to be able to save the work item will have to have all these permissions.

The participant or a precondition can fail. If it does then the save of the work item is not performed. However, if you create stuff in the participant and it fails, I don't think that is going to roll back the changes you want to perform.

I would assume you would have to make sure to tidy up yourself if you can't create all the objects you want to create.

Given all that, wouldn't it a better approach to create the work item and to store some read only attribute there. The operational behavior would check on a certain state change, that the required artifacts exist (another attribute read only in the UI).

You could run a small Plain Java Client in a scheduled build that queries the work items (with higher permissions), finds the ones that have the information stored and a flag that says the artifacts are not yet created, creates the artifacts and sets the flag? 

You can create work items in any project where you have the permission, as far as I can tell.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.