It's all about the answers!

Ask a question

RTC Required attributes for Condition applied for Custom Attributes


Giang Le Thi Thuy (11) | asked yesterday

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


Comments
Ralph Schoon commented yesterday
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.


Giang Le Thi Thuy commented 13 hours ago

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?

2 answers



permanent link
Giang Le Thi Thuy (11) | answered 13 hours ago

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?


permanent link
Ralph Schoon (63.3k33646) | answered 11 hours ago
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited 11 hours ago

You have 

  1. One condition that is either true or false
  2. A configuration of the condition mapping a set of attributes that are required if the condition is true
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.


Comments
Ralph Schoon commented 11 hours ago
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you have distinct attributes in each project area, it might be possible.

Your answer


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