How to get parent workitem attribute in custom editor presentation (dojo templated widget)
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
In web part (dojo templated widget) I need to get parent workitem attribute.
Is there a way to do it?
Process Enactment Workshop version 1.3 in Lab 5 says that:
"It is not possible to access the relationships of a work item, especially to other work items from the links
tab. It is possible to access work item attributes of type work item. This will return the work item handle
but will currently not allow to resolve the referenced work item."
So it's not clear whether it is possible or not.
Maybe it is possible in dojo templated widget via "this.workItem" or similar?
Currently I'm using RTC 4.0.4.
Maybe in newer versions of jazz there will be any support?
Accepted answer
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Comments
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Thanks, Sandeep. So it's not a public API. We will think if it is acceptable for us to use it.
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Hi, Sandeep,
I've tried your way to get the links - it works.
But my initial question had a second part: "In web part (dojo templated widget) I need to get parent workitem attribute. "
So now I have an object with some attributes of linked item. How can I get other attribues of this linked workitem? Particularly I need some custom attribute from linked wi.
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Guys from IBM answered that "It seems
that RTC does not provide the option to get a parent for given work
item using dojo. There is also no build in attribute indicating parent
for given work item. "
But I have managed to get the attribute via OSLC:
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
But I have managed to get the attribute via OSLC:
The required logic with the parent attribute is held in "_setValueFromParentAttr" function.
_parent: function() {
var args1 = {
path: ["linkTypes", "com.ibm.team.workitem.linktype.parentworkitem", "linkDTOs"],
isSource: false,
defaultValue: []};
var list1 = this.workingCopy.getValue(args1);
var itemId="";
if (list1.length > 0) itemId=list1[0].itemId;
if (itemId!="") {
var args2 = {
url: "https://jazzSrv:9443/jazz/oslc/workitems/"+itemId+".json?oslc_cm.properties=rtc_cm:dc:title",
handleAs: "json",
load: dojo.hitch(this, this._setValueFromParentAttr),
error: function(error) {
console.log("error = ", error);
}
};
dojo.xhrGet(args2);
}
}
One other answer
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Comments
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
My widget is based on the article:
https://jazz.net/wiki/bin/view/Main/ContributingAttributePresentations
I use web UI, so the API is:
this.workingCopy.setValue({
path: ["attributes", this.attributeId, "content"],
attributeId: this.attributeId,
value: newValue
});
// Getter
this.workingCopy.getValue({path: ["attributes", this.attributeId, "content"]});
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
So I need to get parent workitem attribute in web UI, using javascript or dojo.
![](http://jazz.net/_images/myphoto/e6e0ae62f6a714d55c2064df9dbc46e4.jpg)
Can anybody help me with solving this question?