Attribute customization condition for precondition
Hello,
I am using CLM Suite 6.0.6.
Following the direction from this post:
I've generated a script based on the example provided here (as a reference from the above link):
I've followed all of the steps to enforce this condition with a precondition, however it seems to not be functional. Since I'm not proficient in scripting, I assume the issue is with the script I've generated. The demo script in the link above is only slightly different conceptually from how I want my condition to function, so I adopted the structure. Here is my script:
dojo.provide("org.example.workitems.providers.WorkActivityToBuild");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
(function() {
var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("org.example.workitems.providers.WorkActivityToBuild", null, {
matches: function(workItem, configuration) {
var atb = workItem.getValue(WorkItemAttributes.AssignedWorkActivity);
return (atb === "AssignedWorkActivity.literal.l4");
} }); })();
The condition "WorkActivityToBuild" needs to resolve to a true or false based on whether or not the "AssignedWorkActivity" attribute is set to the "Assigned To Build" ("AssignedWorkActivity.literal.l4") literal.
Any help would be greatly appreciated.
Accepted answer
WorkItemAttributes gives you the names of most of the built in RTC attributes - it doesn't give you the names of your own custom ones, so the line:
var atb = workItem.getValue(WorkItemAttributes.AssignedWorkActivity);
is not going to return anything useful. Try changing to:
var atb = workItem.getValue("AssignedWorkActivity");
assuming that's the id of your own custom attribute.