It's all about the answers!

Ask a question

error in execution of calculated value script


Aayushi Rag (212) | asked Mar 16 '18, 1:20 a.m.
edited Mar 16 '18, 1:21 a.m.

Hi everyone
i am trying to customize an enumeration attribute named PRIORITY on the basis of another attribute named SEVERITY. the script is as follows

dojo.provide("com.example.ValueProvider");
dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");

(function() {
var WorkItemAttributes=com.ibm.team.workitem.api.common.WorkItemAttributes;
dojo.declare("com.example.ValueProvider", null, {

        getValue: function(attribute, workItem, configuration) {

var sev = workItem.getValue("com.ibm.team.workitem.attribute.severity");
console.log("\n" +sev+"\n");
return this.valuez(sev);
},

checkforLow:function(val)
{
if((sev == "severity.literal.l1") || (sev == "severity.literal.l2") || (sev == "severity.literal.l3"))
{return true;}
else
{return false;}
},

checkforMedium:function(val)
{
if((sev == "severity.literal.l4") || (sev == "severity.literal.l5"))
{return true;}
elsel
{return false;}
},

checkforHigh:function(val)
{
if(sev == "severity.literal.l6")
{return true;}
else
{return false;}
        },
       
        valuez:function(sev)
        {
        if(checkforLow(sev))
        {
        return "Low";
        }
        else if (checkforMedium(sev))
        {
        return "Medium";
        }
        else if (checkforHigh(sev))
        {
        return "High";
        }
       
        }
    });
})();


but i can't get any effect on the rtc system. on checking log file, i got the error as :-
ERROR com.ibm.team.workitem.common   - Error invoking value provider 'AttributeCalculator' associated with the attribute 'Priority' in the project area with id '_FaqaQCNTEeik2I86tKZHPA'. You can link to the project area definition using a URL similar to https://thehostname:9443/jazz/process/project-areas/_FaqaQCNTEeik2I86tKZHPA, where the host name, port and jazz context are configured for your installation.

Accepted answer


permanent link
Donald Nong (14.3k211) | answered Mar 16 '18, 3:25 a.m.

The error basically says that your script is not in the right syntax/format and cannot be parsed. If I'm not mistaken, the second to last line is an extra and should not be there.

Also, I think you just make things overly complicated. You're not building a framework, and the functions there are unlikely to be re-used. I would prefer putting the code in the main function, and it is much easier to understand and maintain.

Aayushi Rag selected this answer as the correct answer

Your answer


Register or to post your answer.