It's all about the answers!

Ask a question

How to read the attributes of WorkItem A in WorkItem B


Mohammad Ramzan (111) | asked Oct 09, 3:55 a.m.

Hallo everyone,

I am struggling to find a solution regarding "How to read the attributes of WorkItem A in WorkItem B"

For example:
We have a workitem (A) named “Risk Matrix Configuration” and a specific attribute of Workitem A is calculated based on same workItem attributes and it works fine.

We have another workItem (B) named “Thread Scenario” and specific attribute of Workitem B need to be calculated based on attributes of WorkItem A but it returns always NULL. For example, while saving WorkItem B the scriptbased attributes (based on attributes from A) were always empty.



I will be very happy to get your support.

One answer



permanent link
Ralph Schoon (63.5k33646) | answered Oct 09, 4:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

It would be beneficial if you provided code, if you had one. 

As far as I know, the official attribute customization JavaScript API does not allow to access any data on remote work items. You would need to get the other work item e.g. using OSLC. This would only work in the EWM Web UI. Attribute customization is also supported in the Eclipse client and there are no such methods available.

https://rsjazz.wordpress.com/2022/11/25/ewm-attribute-customization-introduction/ is an introduction. See the links and the what you can and can not do.

The only way I am aware you can do something like that is using a follow up action or a precondition (if you want to prevent the save). These are server extensions that need to be deployed on the server, so might not be possible in a cloud scenario. Examples:

https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/
https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/

I have no advisor/precondition example, but the API is very similar. Note, another limitation:

https://rsjazz.wordpress.com/2012/12/14/do-not-modify-the-triggering-element-in-an-operationadvisor/ 


Comments
Mohammad Ramzan commented Oct 09, 5:29 a.m.
Hallo Ralph,
We are using Eclipse Client for CCM customized function purpose.

dojo.provide("test_riskMatrix_Calculation");
(function() {
    dojo.declare("test_riskMatrix_Calculation", null, {
    getValue: function(attribute, workItem, configuration) {
var imp1_lik1_str = workItem.getLabel("RiskMatrix_List_Imp1_Lik1");
return imp1_lik1_str;
   }
    });
})();

Here, attribute "RiskMatrix_List_Imp1_Lik1" is part of different workItem defined in the same project.

Thank you.

Mohammad Ramzan commented Oct 09, 5:31 a.m.
Hallo Ralph,
We are using Eclipse Client for CCM customized function purpose.

dojo.provide("test_riskMatrix_Calculation");
(function() {
    dojo.declare("test_riskMatrix_Calculation", null, {
    getValue: function(attribute, workItem, configuration) {
var imp1_lik1_str = workItem.getLabel("RiskMatrix_List_Imp1_Lik1");
return imp1_lik1_str;
   }
    });
})();

Here, attribute "RiskMatrix_List_Imp1_Lik1" is part of different workItem defined in the same project.

1
Davyd Norris commented Oct 09, 8:06 a.m.
The workitem parameter is the current workitem that you're working on, so that would be workitem A. That's why you are not seeing any information

You need some way to navigate to workitem B from A in order to then get its attributes

Ralph Schoon commented Oct 09, 8:10 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You need some way to navigate to workitem B from A in order to then get its attributes

As far as I know that is officially not supported. There might be internal APIs like the proxy, that you could use, but that is undocumented and unsupported.

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.