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

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

RTC6.0.3

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

0 votes

Comments

Based on what event and why?

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

 Yes, there is a way to do that.

Ralph Schoon selected this answer as the correct answer

0 votes

Comments

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

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;
    }
});

})();

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 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: Oct 29 '18, 1:57 p.m.

Question was seen: 1,372 times

Last updated: Oct 30 '18, 2:34 p.m.

Confirmation Cancel Confirm