It's all about the answers!

Ask a question

Automatic defect creation using attribute extension in RTC


Vincent TREBUCHON (36166) | asked Dec 05 '12, 7:25 a.m.
edited Dec 09 '12, 4:11 p.m.
I would like to automate the creation of defect in an external system (via cmd line/program) when a new defect is created in RTC : I would like the 'simpliest' solution and I was thinking of using the javascript attribute customization in RTC (instead of eclipse plugin extension)

Based on the article on jazz.net (https://jazz.net/library/article/1003) and the wiki (https://jazz.net/wiki/bin/view/Main/AttributeCustomization), my idea is :
- define a new custom attribute 'external ID' in the defect work item type (to store the reference id from the external system)
- use the Default Values script based customization to 'fork' the creation in the external system, something like:
dojo.provide("com.example.common.MyClass");
(function() {
dojo.declare("com.example.common.MyClass", null, {
    getDefaultValue: function(attribute, workItem, configuration) {
       var value = ... //Put here my 'external' call to create the 'external' defect
        return value;
    }
 });
})();

Do you think that's a possible/good way to do ?
Do you have a better solution in mind ?

I have also a concern regarding the access of the custom attributes from within the javascript: I'm not sure I will be able to set any value for the 'external ID' attribute using the javascript extension (https://jazz.net/wiki/bin/view/Main/AttributeCustomization#Accessing_built_in_attributes_of) ... Can anyone confirm ?

Thanks for your help

2 answers



permanent link
sam detweiler (12.4k6180201) | answered Dec 09 '12, 4:17 p.m.
If you can make it work, it will only work for uses using the Web UI. Other approaches (Eclipse, api, ...) will not.

Comments
Vincent TREBUCHON commented Dec 10 '12, 6:00 a.m.

Thank you Sam for your answer.
Are you sure about your answer: why should it be working only in the Web UI ?
Reading the wiki, I haven't found such a warning ...


sam detweiler commented Dec 10 '12, 8:58 a.m.

I think of it a different way,,

javascript runs in the browser, and given the right setup, you can make it run when an Eclipse client updates a workitem (I think this is what I read in the extensions doc)... I have never seen it run on the server by itself. (api update of a workitem)

I would do as Ralph suggests.. write an extension..

the syncronizer requires a bunch more setup for each workitem
I have developed a syncronizer as well as a participant.


Ralph Schoon commented Dec 10 '12, 9:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Hi Sam, for JavaScript based customization, the scripts run in the client (Browser or Eclipse client) for some of the providers for some such as calculated values and in the server for some such as conditions. Where which runs is easy to detect. If it runs in the client, you can see it in the Eclipse .log file in .metadata of your workspace. If it runs on the server only in the .log in the .metadata of your server workspace in the work folder (e.g. Tomcat/work)


permanent link
Ralph Schoon (58.2k23642) | answered Dec 09 '12, 4:37 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I am not sure you can do that using the scripting. I would be interested in your findings however.

There are two approaches that would work. Create a Participant that kicks off the external call. You can call anything you want, a shell script, a java class. A participant as a server extension is relatively easy and there are many examples out there. I have published a bunch on https://rsjazz.wordpress.com/. This is the easiest way to do it as far as I can tell.

You can also implement your own synchronizer using the synchronization framework that is available in the API and the Plain Java Client Libraries.

I would go for the Participant. The detection of a new work item is easy enough to do and you have easy access to all the work item data there too.

Your answer


Register or to post your answer.