This article shows how you can move your existing Sync Rules scripts into an external scripts library.

Pre-requisites

  • Example scripts project with the following files: DataFilter.groovy, CreateProcessor.groovy, ChangeProcessor.groovy. 
    Download example project


Steps to move your Sync Rules into the external directory

  1. Open the DataFilter.groovy file to edit in your development environment

  2. Copy-paste the code from the Outgoing sync(data filter) into the DataFilter.groovy file 

    Please read code comments to get more details where to paste the code in the file.

  3. Call the groovy file in the Sync Rules using the code provided in the file comment

    The comment is located on the top of the file, below you can see how it looks. For more details check Groovy imports

    /**
    Replace your "Outgoing sync (data filter)" with this snippet:
    
    DataFilter.execute(
       replica,
       issue,
       nodeHelper,
       commentHelper,
       workLogHelper,
       userHelper,
       connection,
       issueKey
    )

  4. Repeat the steps for CreateProcessor.groovy and ChangeProcessor.groovy files.