Confluence has been updated to version 6.15.9

Page tree
Skip to end of metadata
Go to start of metadata

Introduction

The required attribute of the custom field configuration has no effect on the behaviour of the grid. This faq details out how you can test if the grid has been modified when creating an issue


Solution

This solution is based on the Script Runner.  Checking if a grid has been modified during the create transition, can be done by 

adding a script validator to the transition.

To do so 

  • Install the script runner
  • Add a "Simple scripted validator" to the Create transition with following script

    return cfValues['Family List'].toString().length() >= 30;


    (of course change "Family List" with the name of your grid.
    This will test if something has been changed in the script.

Why would this work ?

When a user modifies something in the grid, the grid adds a 'command' to the custom field value.
This command will be processed by the add-ons backend updating data in the grid table.

The initial value of the customfield value (when a user starts editing the grid) is 
[["tempId","u1401981860979"]] where uxxx is the name of the temporary table where
intermediary changes are stored until the edit is persisted.

 

What happens when cloning an issue ?

This validator will fail when cloning an issue.  (Check gd.initFromClone how to copy table grids when cloning)
The reason is that the customfieldvalue of the table grid will not contain any value.

There is a solution - check that OriginId is not empty as in

cfValues["OriginId"] != null ||  cfValues['Family List'].toString().length() >= 30

The reason why this works is because when an issue is cloned, it will inherit the OriginId from the parent issue,
and that value will be set when cloning, but will be empty when the issue is being created.

Check also Behind the scenes of gd.initFromClone