Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Automatic defect creation using attribute extension in RTC

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

0 votes



2 answers

Permanent link
If you can make it work, it will only work for uses using the Web UI. Other approaches (Eclipse, api, ...) will not.

0 votes

Comments

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 ...

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.

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
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Dec 05 '12, 7:25 a.m.

Question was seen: 5,999 times

Last updated: Dec 10 '12, 9:06 a.m.

Confirmation Cancel Confirm