| Useful Information Implemented in Jira Suite Utilities from version 0.6-EA1 http://confluence.atlassian.com/display/JIRAEXT/JIRA+Suite+Utilities |
Here is code for a post function to clear / void a custom field of an issue. However, please take note that if the updateValue() method of the CFType is overriden (such as ImportIdLinkCFType's), it might not perform the desired action.
public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException { MutableIssue mIssue = (MutableIssue) transientVars.get("issue"); CustomFieldManager cfm = ComponentManager.getInstance().getCustomFieldManager(); // To retrieve/print the value: // CustomField cf = cfm.getCustomFieldObject("customfield_10070"); // System.out.println("Clearing value: "+mIssue.getCustomFieldValue(cf)); mIssue.setCustomFieldValue(cfm.getCustomFieldObject("customfield_10070"), null); }

Comments (2)
Mar 28, 2007
dm says:
do those commented lines retrieve the field from the database, or just from the ...do those commented lines retrieve the field from the database, or just from the parameters of the function,
how do you retrieve the current field from the actual database
May 07, 2007
Dmitry Taur says:
Is there any trick in clearing a custom field value for a subtask? It does work ...Is there any trick in clearing a custom field value for a sub-task?
It does work for an issue but doesn't work for a sub-task.