Can you clear out the value in the "Planned For" field using java script
Accepted answer
Yes, there is a way to do that.
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.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Oct 29 '18, 2:16 p.m.Based on what event and why?
nannette Mori
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.