IBM Support

Custom attribute script error: TypeError: Cannot read property "common" from undefined

Troubleshooting


Problem

Customer is using a script-based condition for a read-only attribute:
dojo.provide("mycompany.team.workitem.condition.phase.readonly");
(function() {
	dojo.declare("mycompany.team.workitem.condition.phase.readonly", null, {
		matches: function(workItem, configuration) {
			var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;
			var WSTATE = workItem.getValue(WorkItemAttributes.STATE);
			if (WSTATE != undefined) {
				return true;
			}
		}
	});
})();

Symptom

The script works as expected (the attribute is modifiable on creation but not on any other state) but the following error is observed in the ccm.log
Caused by: org.mozilla.javascript.EcmaError: TypeError: Cannot read property "common" from undefined (phase-readonly.js#5)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)
        at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3535)
        at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3563)
        at org.mozilla.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3582)
        at org.mozilla.javascript.ScriptRuntime.undefReadError(ScriptRuntime.java:3595)
        at org.mozilla.javascript.ScriptRuntime.getObjectProp(ScriptRuntime.java:1381)
        at org.mozilla.javascript.gen.c583._c2(phase-readonly.js:5)
        at org.mozilla.javascript.gen.c583.call(phase-readonly.js)
        at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
        at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
        at org.mozilla.javascript.gen.c583.call(phase-readonly.js)
        at com.ibm.team.rtc.common.scriptengine.internal.bridge.proxy.AbstractInvocationHandler$MethodHandler$1.run(AbstractInvocationHandler.java:160)

Document Location

Worldwide

[{"Line of Business":{"code":"LOB77","label":"Automation Platform"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSUC3U","label":"IBM Engineering Workflow Management"},"ARM Category":[{"code":"a8m50000000CjkHAAS","label":"Team Concert-\u003EWork Items-\u003EWeb UI-\u003ECustomization"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
15 September 2020

UID

ibm16332955