It's all about the answers!

Ask a question

Can you clear out the value in the "Planned For" field using java script


nannette Mori (501985) | asked Oct 29 '18, 1:57 p.m.

RTC6.0.3

Is there a way to set the timeline back to unassigned(null) using javascript?


Comments
Ralph Schoon commented Oct 29 '18, 2:16 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Based on what event and why?


nannette Mori commented Oct 29 '18, 2:33 p.m.

RTC6.0.3

Our CR workflow has to different workflows, one that will use the "Planned For" Field and the other workflow where the "Planned For" field will be used if the CR is associated with an Epic workitem. I implemented a validator that gets the Value of the Epic (yes/no) enumeration field and if the Planned For is unassigned it throws an error "Increment must be set"  However if for some reason the user sets the Epic field back to "No" we wanted to set the "Planned For" field back to "Unassigned"(null) using the java script.

Accepted answer


permanent link
Ralph Schoon (63.6k33646) | answered Oct 30 '18, 3:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 Yes, there is a way to do that.

Ralph Schoon selected this answer as the correct answer

Comments
nannette Mori commented Oct 30 '18, 10:16 a.m.

Can you give me an example of how to set the value to null using java script?


Ralph Schoon commented Oct 30 '18, 10:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

You return null in a calculated value.

/***********
 * Licensed Materials - Property of IBM
 * (c) Copyright IBM Corporation 2011. All Rights Reserved.
 *
 * Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule * Contract with IBM Corp. ***********
/ dojo.provide("com.example.eraseTarget");

(function() { dojo.declare("com.example.eraseTarget", null, {

    getValue: function(attribute, workItem, configuration) {

        var target = workItem.getValue("target");   
        var prio = workItem.getLabel("internalPriority");
        if(prio!=null && prio=="High"){
            return null;
        }
        return target;
    }
});

})();


Ralph Schoon commented Oct 30 '18, 1:26 p.m. | edited Oct 30 '18, 2:34 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

See https://rsjazz.wordpress.com/2016/07/15/rtc-process-customization-what-you-can-and-cannot-do/


Attribute customization only allows to return values to a specific attribute. It is not possible (from the described API) to change another attribute. 

The approach above is a calculated value that checks if the event to erase attribute "target" happens and then returns null. It returns the current value otherwise.

Note that attribute customization is for all attribute types that have the attribute - or you need to check the type, etc.

Your answer


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.