How to get attachment file name of a work item in a customized attribute
How can I get attachment file name of a work item in a customized attribute (calculated value or value set)?
Do we have any way to do?
Background; A customer is using RELM to search RTC artifacts but attachment file name cannot be searched, so he is thinking to put the attachment filename in a customized attribute in a work item.
We are thinking to use HTTP Filtered Value Set Provider as one possible way, it is not successful to run yet.
http://jorgediazblog.wordpress.com/2012/06/27/work-item-customization-httpconector-and-oauth-in-rtc-4-0-for-oslc/
https://jazz.net/wiki/bin/view/Main/DataSourceValueSetProviders#Tutorial_for_providing_a_custom
https://jazz.net/forum/questions/145566/rational-team-concert-use-httpconnectorparameters-on-calculated-value-script-based-custom-attribute
https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20#Introduction
|
Accepted answer
Hello,
I don't think this can be done: attachment(s) is not an attribute but a link.
You can use RTC Queries to search on attachments names, id:
Eric
Ralph Schoon selected this answer as the correct answer
Comments
Taki Nakajo
commented Jul 04 '14, 3:22 a.m.
How to run a query in calculated value or value set? the only approach that might work is described here: http://jorgediazblog.wordpress.com/2012/06/27/work-item-customization-httpconector-and-oauth-in-rtc-4-0-for-oslc/
|
2 other answers
Ralph Schoon (63.6k●3●36●47)
| answered Jul 03 '14, 4:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Takki,
as far as I am aware you can't access the attachments collection from JavaScript in calculated value providers. See: https://jazz.net/library/article/1093 Lab 5 especially the limitations. You might be able to use tricks like the one provided by Jorge to succeed. Another way to proceed might be using Java as described here: https://rsjazz.wordpress.com/2013/06/26/attribute-customization-java-based-value-providers-conditions-and-validators/ JavaScript won't allow you to do this, I am sure. Comments
Taki Nakajo
commented Jul 04 '14, 3:45 a.m.
In my testing, if I do the following, it works.
1. Customize attribute > Add Value set 'myValueSet’ / provider: HTTP Filtered Value Set Provider >
Configuration:
XML data source URL: https://<host>:9443/ccm/oslc/workitems/15/rtc_cm:com.ibm.team.workitem.linktype.attachment.attachment
Row XPath : //Collection/Attachment
Column XPath expression: ./title
Column Identifier : title
Authentication method: OAuth
Taki Nakajo
commented Jul 04 '14, 3:45 a.m.
2. Create an attribute ’TestField1’
3. Set the value set 'myValueSet’ in the attribute.
4. Add an editor presentation for the attribute with kind:picker.
But If I add an editor presentation for the attribute with kind:string, it won't work because it seems the return value is array.
Taki Nakajo
commented Jul 04 '14, 3:57 a.m.
Also it works by following:
1. Customize attribute > Add Value set 'myValueSet3’ / provider: Script based value set >
dojo.provide("com.example.ValueSetProvider3");
dojo.require("com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters"); (function() { dojo.declare("com.example.ValueSetProvider3", null, { getValueSet: function(attributeId, workItem, context){
Taki Nakajo
commented Jul 04 '14, 3:57 a.m.
var params= new com.ibm.team.workitem.api.common.connectors.HttpConnectorParameters();
1
Taki Nakajo
commented Jul 04 '14, 3:58 a.m.
while(values.hasNext()){
Taki Nakajo
commented Jul 04 '14, 3:59 a.m.
But If I add an editor presentation for the attribute with kind:string instead, it won't work.
showing 5 of 6
show 1 more comments
|
hi
this line of code
seems to be particular for a work item .
how to make it generic so that when we open a wok item its displays the attachment name attached to this work item.
|
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.