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
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
If you can make it work, it will only work for uses using the Web UI. Other approaches (Eclipse, api, ...) will not.
Comments
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.
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.