Assistance Required: Conditional mapping/masking of source project names in Incoming Sync script

Hi Team,

We have a specific business requirement for our Jira-to-Jira integration using the Exalate plugin and are looking for your guidance on the best way to script it.

Our Current Setup:
Whenever an issue is synced from the Source instance to our Destination instance, we capture the source project’s name using replica.project?.name. This value is populated into a custom Select List field named “Source” on the destination side.

Our Requirement:
For security and privacy reasons, we need to mask certain source project names. Instead of displaying their real names in the destination “Source” field, we want them to appear as “Roomed”.

  • If the source project is on our “mask list”, the destination field should be set to “Roomed”.

  • If the source project is not on that list, it should continue to display its real project name as it does currently.

Could you please review our intended approach and provide the recommended, production-ready Groovy script snippet for our Incoming Sync script? Specifically, we want to ensure we handle nodeHelper.getCustomFieldOption correctly so it doesn’t throw errors if a value is null or mismatched.

You can achieve this requirement in your Incoming Sync script by defining a list of project names that should be masked. Then, use a conditional to check if the incoming project name is in that list. If it is, set the custom field to “Roomed”; otherwise, use the actual project name. To safely set a Select List field, use nodeHelper.getCustomFieldOption and handle cases where the value might not exist.

Here’s a production-ready Groovy snippet for your Incoming Sync script:

// List of project names to be masked
def maskList = ["Sensitive Project 1", "Secret Project 2", "Confidential XYZ"]

// Get the source project name from the replica
def sourceProjectName = replica.project?.name

// Determine the value to set
def fieldValue = maskList.contains(sourceProjectName) ? "Roomed" : sourceProjectName

// Safely get the custom field option
def sourceOption = fieldValue ? nodeHelper.getCustomFieldOption("Source", fieldValue) : null

// Set the custom field if the option exists
if (sourceOption) {
    issue.setCustomFieldValue("Source", sourceOption)
} else {
    // Optionally, clear the field or handle missing option
    issue.setCustomFieldValue("Source", null)
}

This script ensures:

  • Only projects in your mask list are replaced with “Roomed”.
  • The custom field is set using nodeHelper.getCustomFieldOption, which avoids errors if the value is null or doesn’t match an existing option.
  • If the option doesn’t exist, the field is cleared (you can adjust this behavior as needed).

For more details on setting Select List fields in the Incoming Sync script, see the documentation:
https://docs.exalate.com/docs/how-to-set-select-list-fields-in-jira-using-the-incoming-sync-script

Let me know if you need further customization!

Hi @pramak1X,

Thank you for sharing your use case with us.

Please let me know if Aida’s suggestions do not help resolve the issue. I’d be happy to assist you further.

Kind regards,

Ashar

Hi @pramak1X ,

Just following up on this topic. If Aida’s suggestions did not resolve your use case, please let us know—we’ll be happy to help and guide you further.

If the suggestions worked for you, please consider marking the response as Answered.

Kind regards,
Ashar