It's all about the answers!

Ask a question

Calculated script works in Eclipse IDE but not in browser

Soham Saini (112) | asked Jan 05 '16, 2:33 a.m.
I wrote a calculated script on Closed by, which auto populates the Closed By field by the person who closes the defect. The script works fine in Eclipse but when I perform the same steps I get the error as :"Attribute 'Closed By' not set.The 'Closed By' attribute needs to be set (work item XXXXXX)."
Steps followed.
1. User B, Created a workitem.
2. Transitioned the workitem to Verify state.
3. Value of Closed by is either Unassigned OR User A.
4. User B closes the defect.
5. In Eclispe->Closed BY is auto populated by User B.
    In Browser -> Get the error

Attribute 'Closed By' not set.The 'Closed By' attribute needs to be set (work item XXXXXX)."

Dinesh Kumar B commented Jan 05 '16, 4:06 a.m.

Hi Soham,

I feel something within the script is causing this...

have you tried using firebug or chrome debugging to see if the script returns any error on web browser..

if you could share the sample script.. it may be easier to understand.

Soham Saini commented Jan 05 '16, 5:23 a.m. | edited Jan 05 '16, 5:24 a.m.


(function() {
    var WorkItemAttributes=;
    var scriptname ="getClosedBy";
    var doDebug = true;
    var modifiedBy ="";
    dojo.declare("", null, {
        getValue: function(attribute, workItem, configuration) {
            var currentState = workItem.getValue(WorkItemAttributes.STATE);
            var closedBy = workItem.getValue("closedby");
            var workitemType = workItem.getValue(WorkItemAttributes.TYPE);
            modifiedBy = workItem.getValue(WorkItemAttributes.MODIFIED_BY);
                if(currentState =="Closed")
                    // return the rtc user who modified the last
                    return modifiedBy;            
                    //return existing value, so no change
                    return closedBy;
            function debug(display){
                    console.log(scriptname + ": " + display);

Ralph Schoon commented Jan 06 '16, 11:07 a.m.

You can not not return something. In the case of !(workitemType=="defect") you don't return a value - this makes the script syntactically incorrect.
You could return the value the attribute has in this case.

One answer

permanent link
Kot T. (1.5k11219) | answered Jan 06 '16, 10:44 a.m.
See for a technique you can use to debug attribute customization scripts.

Your answer

Register or to post your answer.