It's all about the answers!

Ask a question

Remove and Set Parent-Child relationship through plugin

Amit Girme (1131927) | asked Mar 19 '13, 5:42 p.m.
 Hi All,

In RTC,a parent- child relationship is set between 2 Work items.Now based on a particular condition i want to remove this linkage automatically.

for e.g. i have 2 work items A and B with parent-child Relationship. Now i want to remove B and attach it as a child to Work Item 'C' 

How can i do this through plugin?


One answer

permanent link
sam detweiler (12.5k6195201) | answered Mar 19 '13, 10:02 p.m.
from the help about ILinkType in the SDK. You will have to write a java plugin.. not javascript.

Open Declaration

Links represent directed relationships between two endpoints, the source and target. Each endpoint is represented by an IReference , which can refer to a Jazz item, or to anything else (via a URI). Links that are intended to be undirected (symmetric) can be handled as described below.

Links have types that indicate the kind of relationship, such as duplicate or blocks. These types are specified by means of link type ids, which are expected to be unique across an entire Jazz repository, and hence are usually dotted strings that include a component name, such as "" or "" from the work item component. Each link (instance) contains the appropriate link type id, and methods are provided for finding links of specified types.

The link type ids are usually not suitable for display purposes. Also, the appropriate display name might differ depending on the direction: the target being viewed from the point of view of the source, or the source being viewed from the point of view of the target. Accordingly, link types have two IEndPointDescriptor s, one describing the source and the other the target. Each can specify a display name and icon for the endpoint, appropriate for use when that endpoint is displayed from the point of view of the other. For example, the "" link type has a source end point descriptor with display name "Depends On" and a target end point descriptor with display name "Blocks". In an editor for the source, the links page will show the target under "Blocks," whereas in an editor for the target, the links page will show the source under "Depends On." Methods are provided for getting the other end point reference and descriptor given the one in hand, to allow uniform coding of this kind of display without the client having to worry about whether it is starting from the source or target.

An IEndPointDescriptor can also specify some further details of its end point. For end points that are references to items, the descriptor can specify the required IItemType . If this is not specified, any item is allowed. The multiplicity can also be specified, either "0..1" indicating single- valued or "0..n" indicating multi-valued. Multiplicity is currently for use by clients only; the link component does not check that it is observed as links are created.

Link types are defined to the link component using the extension point. It allows specification of the link type id and the end point details noted above. If no end point descriptors are specified, the link component creates default ones. If only one end point descriptor is specified, the link component creates the other one with the same details; this effectively supports undirected (symmetric) links, which are treated the same in either direction (e.g., "Related"). The definitions are stored in the singleton registry ILinkTypeRegistry.INSTANCE , where they are available to clients.

Link are IAuditable s. They are immutable. If an end point of a link is changed, the result is deemed to be a different link - the change must be effected by deleting the current link and creating a new one.

The link component provides for manipulation of links either client-side or server-side, using similar methods. ILinkManager provides client-side operations for creating, deleting, saving and finding links. It is a Jazz client library that can be obtained from a ITeamRepository in the usual way. ILinkServiceLibrary provides similar server-side access, as a service library. An instance can be obrained from the ILinkService

Amit Girme commented Mar 20 '13, 4:47 a.m.

Hi Sam,

Thanks for the reply,

I tried different things in the plugin, but am not able to achieve this.
Sometimes it gives Stale Data exception  and sometimes it just save and changes the state without giving any exception.

 Now how can i break this linkage(between A(Parent)-C(child) ) and set work item C as a child of work item B through Plugin.

Can you please help me with the same?

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.