Created by
Tony Gough
| /* The code below should be run in the Script Console.
*
* This script is used to address a symptom of bug SRCONF-455 which caused script macros to be created with badly formatted parameter data.
* The script deletes and resets all parameter data of any script macros which were affected by this.
*
* All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner
* license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed
* or amended and must be included in any circumstances where the code snippet is shared by You or a third party."
* @author: Tony Gough
*/
import com.onresolve.scriptrunner.confluence.macro.ScriptMacroManager
import com.onresolve.scriptrunner.runner.util.AOPropertyPersister
import groovy.json.JsonSlurper
def items = AOPropertyPersister.loadList(ScriptMacroManager.AO_PROPERTY_KEY) as List<Map>
def jsonSlurper = new JsonSlurper()
def blankArgs = jsonSlurper.parseText('{ "arguments": [] }')
items.collect { item ->
if (item.FIELD_MACRO_ARGS.getClass() == String)
item.FIELD_MACRO_ARGS = blankArgs
}
AOPropertyPersister.save(items, ScriptMacroManager.AO_PROPERTY_KEY)
|