RTC Required attributes for Condition applied for Custom Attributes
We are having the condition script below for some attributes "ASIL Level, Basket, Feature Area, Filed Against, Found In, Occurrence, Priority, Regions, Variant":
dojo.provide("com.example.mandatory");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function()
{
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.mandatory", null,
{ matches: function(workItem, configuration)
{
var PA = workItem.getLabel(WorkItemAttributes.PROJECT_AREA);
var ST = workItem.getLabel(WorkItemAttributes.TYPE);
return (PA=="A" && ST=="Bug")|| (PA=="B" && ST=="Bug") || (PA=="C" && ST=="Bug"); }
}); })();
Now we need to add one more condition for project "A" (for all work item type) and apply for only "Brands"
How can we update in the same script?
Even i tried with the script below but it does not work :(
dojo.provide("com.example.gmvcu.mandatory");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function()
{
var WorkItemAttributes= com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.gmvcu.mandatory", null,
{ matches: function(workItem, configuration)
{
var PA = workItem.getLabel(WorkItemAttributes.PROJECT_AREA);
var ST = workItem.getLabel(WorkItemAttributes.TYPE);
if (PA=="A" && ST=="Bug") {
return true;
} else if (PA=="B" && ST=="Bug") {
return true;
} else if (PA=="C" && ST=="Bug") {
return true;
} esle if (PA=="A") {
return true;
}
return false;
}
}); })();
Could you please help us? What should be the best solution? Should we update in the same script or create new? Thank you for your responses
|
2 answers
Hi Ralph Schoon Thanks for your response May be, I didn't frame the question properly . Sorry for that. Below is my requirement: Use case 1: Type=Bug, Project=X , make the attributes attr_1 & attr_2 as mandatory Use case 2: Type = Bug, Project=Y, make the attributes attr_3 as mandatory
Is there a way to handle both these use cases via a single "Conditions" script instead of 2 separate scripts to avoid maintenance issues? Comments
Davyd Norris
commented Jul 25, 11:18 p.m.
I agree with Ralph - these are two different conditions for two different attributes.
Conditions do not have access to what rules or attributes they are attached to, so there is no way to work out if you're talking about attr_3 inside the condition and hence no way to figure out if you should return true or not. Make them separate conditions - one for attr_1 and attr_2, and one for attr_3
|
Ralph Schoon (63.6k●3●36●46)
| answered Jul 25, 4:46 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Jul 25, 4:50 a.m. You have
Can you have an attribute of the set being mandatory and one being optional?
Condition C, Attributes Aa, Ab
Condition C is true => Aa mandatory, Ab mandatory. Or Attribute Aa mandatory => C = true, Ab optional => C=false is a contradiction. That means no. That are my thoughts. Unless there is something else I am forgetting. |
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.
Comments
I do not know if it is possible to answer the question. I would suggest to debug the script. See https://rsjazz.wordpress.com/2022/11/17/debugging-ewm-work-item-attribute-customization-javascript/ how this can be done. As an alternative you could add logging of your script. See the links on our guideline.
Hi Ralph Schoon
Thanks for your response
May be, I didn't frame the question properly . Sorry for that.
Below is my requirement:
Use case 1: Type=Bug, Project=X , make the attributes attr_1 & attr_2 as mandatory
Use case 2: Type = Bug, Project=Y, make the attributes attr_3 as mandatory
Is there a way to handle both these use cases via a single "Conditions" script instead of 2 separate scripts to avoid maintenance issues?