How to get value of attribute in Java based calculated value provider plug-in
Mallanagouda Patil (40●8●15)
| asked Jun 27 '17, 8:18 a.m.
edited Jul 04 '17, 4:21 a.m. by Ralph Schoon (63.5k●3●36●46) Hi All,
Developing Java based Calculated Value Provider plug-in to integrate RTC with external application through REST APIs. Need to get value of the attribute and send it to external application through REST API. The problem is that the getValue(IAttribute) API of WorkItem returns empty when workitem created in WebUI however the same work when workitem created in EclipseUI. It works when Workitem Save button is pressed in WebUI. However it does not when dependency triggered.
Not sure why this change in behaviour while working WebUI & EclipseUI. It appears that script is needed to make it work with WebUI but how to integrate Script and Java method?.
If not is there way to consume REST APIs in calculated value provider script?. I do not see any such support as HTTPConnect facility limited to Validator only.
Please suggest. Thanks in advance!.
|
Accepted answer
This works as designed, when using a Java based Calculated Value Provider, the provider gets triggered only on Save and not when it is dirty, however when using a script based value provider, it gets invoked when the work item is dirty because the script is loaded in the browser. Mallanagouda Patil selected this answer as the correct answer
Comments
Mallanagouda Patil
commented Jul 06 '17, 7:11 a.m.
Hi Shroon,
var severity= workItem.getValue(WorkItemAttributes.SEVERITY); console.log("Severity value is " +severity); https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Calculated_values
Mallanagouda Patil
commented Jul 06 '17, 7:12 a.m.
/sample script/
|
2 other answers
I just noticed that you are also looking at an alternative to invoke REST service from a script, this should be possible. Have you tried invoking a REST service from a script and have hit any issues with that approach? I would expect it to work like any REST call done via a javascript for example. Comments
Mallanagouda Patil
commented Jul 04 '17, 2:57 a.m.
Sharoon
|
Develop data-connector plug-in as explained here https://jazz.net/wiki/bin/view/Main/DataSourceValueSetProviders#Tutorial_for_providing_a_custom and then use the same in Calculated Value Provider Script to integrate with external REST services.
|
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.
Comments
Here is the sample code am trying