It's all about the answers!

Ask a question

dojo script for calculated values are behaving differently in Production and QA


Chandra Prakash k (21214) | asked Jan 23 '17, 4:44 a.m.

 Hi,


We have two different environments called Production and QA (Test machine) which has same configuration and settings. But we seen an strange behavior with dojo script calculated value for custom attribute (called "Shared Date"), which will populate the date depends on the boolean attribute(Shared).
 
i.e.: dojo script set the "Shared date" field with date when "Shared" attribute is set true.  

Below dojo script is used to populate the date for shared date.
======================================================================
dojo.provide("com.visteon.shareddate");

dojo.require("com.ibm.team.workitem.api.common.WorkItemAttributes");
dojo.require("dojo.date");
dojo.require("dojo.date.stamp");

(function() {
    var WorkItemAttributes = com.ibm.team.workitem.api.common.WorkItemAttributes;

    dojo.declare("com.visteon.shareddate", null, {
        getValue: function(attributeId, workItem, configuration)
        {

            console.log("Enter sharedDate");
            var sharedDate= dojo.date.stamp.fromISOString(workItem.getValue("com.visteon.shared.date"));
            var isShareable = workItem.getValue("com.visteon.shareable");
       var currentDate= new Date();

//            console.log("Shared date is " + sharedDate);
//            console.log("Shareable box is " + isShareable);
//            console.log("CurrentDate is " + currentDate);

            if(sharedDate == null)
            {
//                console.log("SharedDate is null");
                if(isShareable == true)
                {
//                    console.log("shareable checkbox is checked");
                    return currentDate.getTime().toString();
                }
//                console.log("shareable checkbox is NOT checked");
    }
//    console.log("SharedDate is NOT null");
    return sharedDate.getTime().toString();
}
  });
})();
====================================================================
 
Issue: "Shared date" is added for defect WI on March 2016 and did not sync attribute for existing WI, as it is required only for newly created WIs. calculated value is configured with dojo script were expected to fill the date when shared attribute is selected enable. But the work items which was created before March 2016, is showing Shared Date attribute value as current date(i.e Date when you run the query) in web and even exports the same in eclipse. However the same dojo script works as expected in QA environment, it is not showing any date for the work items where shared date attribute is not sync. 
We noticed this issue only after upgrading our environment from RTC 5.0.2 to RTC 6.0.2 iFix006.

Please let me know is there any settings we have to consider for RTC 6.0.2 or do we need do any changes in dojo script.
Thanks in advance.


Comments
Donald Nong commented Jan 23 '17, 8:12 p.m.

Running a query does not trigger the calculated value script. So what you described is a bit confusing. If you open a work item from the query result set, do you see the same current date value in the "Share Date" attribute?


Chandra Prakash k commented Jan 24 '17, 2:04 a.m.
 Hi Donal Nong,

You are correct, running the query is not triggering the calculated value. In our case calculated value is only triggers if and only if "shared" attribute is made "true".
 
Opening work item is not showing anything, since "shared date" is not synced.

Current date is showing only in Query result pane (add the shared date column to show the values in work items tab) in Web client and export CSV (from both eclipse and web). expected value is "n/a" or blank for shared date column.

Ralph Schoon commented Jan 24 '17, 2:22 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What does "where shared date attribute is not sync" mean?


Chandra Prakash k commented Jan 24 '17, 4:11 a.m.

 Hi Ralph Schoon,


"Shared Date" is an custom attributed(calculated value) and it is not synced for the existing work items. We want "Shared Date" field to be visible only for newly created work items, but if i query all the work items (Existing and Newly created) then query results showing current date as "Shared Date" for existing WI instead of "n/a" .

I hope I have answered your question.

Be the first one to answer this question!


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