Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

error in execution of calculated value script

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.

0 votes


Accepted answer

Permanent link

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

1 vote

Your answer

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

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Mar 16 '18, 1:20 a.m.

Question was seen: 985 times

Last updated: Mar 16 '18, 3:25 a.m.

Confirmation Cancel Confirm