How to clear the data from the grid on the transition screen using Jira Suite Utilities

Introduction 

 Jira Suite Utilities "Clear Field Value" post-function (JSU "Clear Field Value" post-function) does not truncate the records in the Table Grid Editor (TGE). The grid stores the records for each issue in a table in a database. TGE does not store the records in the TGE grid custom field value. Thus, when the JSU "Clear Field Value" post-function clears the TGE custom field value, it does not affect the database records for the grid, and thus does not affect the grid you see in an issue.


Solution

If you want the grid to remove all the records for an issue, we recommend using Script Runner add-on, which executes a script on the desired issue workflow transition.

The script helps to get the Table Grid Editor custom field and sends remove all command to the grid. The script would look something like this:

 

def issue = getTheIssue() // fake function, most probably you would get `issue` like this: `((com.atlassian.jira.issue.IssueManager) com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType (com.atlassian.jira.issue.IssueManager.class)).getIssueObject("KEY-100")` def tgeCustomField = getTGECustomFieldObject() // fake function, most probably you would get `tgeCustomField` like this: `((com.atlassian.jira.issue.CustomFieldManager) com.atlassian.jira.component.ComponentAccessor.getOSGiComponentInstanceOfType (com.atlassian.jira.issue.CustomFieldManager.class)).getCustomFieldObjectByName("System Components")` tgeCustomField.getCustomFieldType().updateValue( tgeCustomField, issue, "[[\"tempId\",\"u1382690784979\"],[\"all\"]]" )