RTC - javascript - parent link required howto
Hi,
Is it possible to have a parent type link be entered when saving a workitem in RTC?
I guess that goes through attribute conditions, but how do you access links to a workitem?
|
Accepted answer
One other answer
Ralph Schoon (63.6k●3●36●46)
| answered Jan 28 '19, 2:29 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Yes, this is possible.
The officially supported Java Script API does not have the capability to detect links.
There is a work item proxy, that seems to allow finding links in JavaScript.
var proxy = workItem.getProxy();
This only works in the Web UI, is unsupported and should only be tried by really experienced JavaScript developers. There are posts in this forum using this.
Requiring a link to a work item can be achieved using a work item save advisor. Here an example of an advisor https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/
The blog has also examples around link APIs. E.g. https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/
Comments Thanks.
The workItem.getProxy() is the perfect solution.
I can read the workItem.getProxy()._valueSets._workItem._proxy.object.linkTypes array to check the links defined in the workItem.
It is possible to use the getProxy().storedObject to search for the workItem datas.
Perfect. Thanks.
Ralph Schoon
commented Jan 29 '19, 10:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Note that this is all not supported and does also not work in the RTC Eclipse client.
Olivier ROSET
commented Jun 05 '19, 8:17 a.m.
Yes, and a strange behavior appears when we use workItem.getProxy() in, by example, ) attribute Validator javascript.
If we just do a call of this method, in the validate method of the validator code :
validate: function(attributeId, workItem, configuration) {
var proxy = workItem.getProxy();
return new Status(Severity["ERROR"], "Feature sans EPIC parent !");
}
then the "return new Status() ..." is not interpreted.
If we remove the line : var proxy = workItem.getProxy(), everything works fine.
Davyd Norris
commented Jun 05 '19, 7:50 p.m.
I think you have something else going on there - calling getProxy() in that situation works fine for me.
|
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.