Problem fetching server details of a workitem in calculated value script
Hello team
I am using a calculated value script to get the status of the work item ,
In addition to that i have a requirement where in I need to get server detail of the work item ,
I tried using below code , but seems like window.location (java script functionality) is not working in calculated value script .
dojo.provide("com.rtc.js.client.Script");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.rtc.js.client.Script", null, {
getValue: function(attribute, workItem, configuration) {
var workitemstatus = workItem.getValue(WorkItemAttributes.Status);
var workitem_window_location=window.location.href();
return workitem_window_location;
}
}
});
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.rtc.js.client.Script", null, {
getValue: function(attribute, workItem, configuration) {
var workitemstatus = workItem.getValue(WorkItemAttributes.Status);
var workitem_window_location=window.location.href();
return workitem_window_location;
}
}
});
Note: I tried window.location because it gives server details like https://someserver.elm.example.com:9443/ccm so that i can parse and get the server address of the workitem
Any idea on other methods like how to get the server details of a work item ? Please help
Thank you so much in advance
One answer
Hi,
I am not aware that there is any public API for what you ask for. The available API is explained here: https://jazz.net/wiki/bin/view/Main/AttributeCustomization and there are some more examples here: https://jazz.net/wiki/bin/view/Main/AttributeCustomizationExamples . You will notice that they all are based on values of the attributes of the work item and configuration information.
If you search deeper, you will find hints how to get more information e.g. see https://jazz.net/forum/questions/133477/work-item-customization-getting-current-user-as-logged-in-user and https://jazz.net/forum/questions/258239/in-a-work-item-attribute-validator-customization-how-can-i-specify-a-value-is-invalid-if-they-have-not-linked-a-parent . But as far as I can tell, all of these are only using in the Web UI and are essentially using unsupported undocumented API.
I don't know of a way to get to the information you seek. I am not convinced you should try this either.
You can use a JAVA extension mechanism for calculated values, that provides more means to access information.
I'd suggest to be careful with what you do in customization, because we have seen users doing it wrong killing their performance.