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? |
![]()
Ralph Schoon (63.3k●3●36●46)
| answered 11 hours ago
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited 11 hours ago 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?