Hello Team,We are trying to add one transition in workflow, which will check if the package given in the task exist in artifactory or not?could you please help me to write script validator?
Hi,
I have not tested but this should be a start:
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.CustomFieldManagerimport com.atlassian.jira.issue.fields.CustomField// Get the custom field that contains the package nameCustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()CustomField packageField = customFieldManager.getCustomFieldObjectByName("Package Name")// Get the package name from the issuedef packageName = issue.getCustomFieldValue(packageField)// Check if the package exists in Artifactoryif (!artifactory.packageExists(packageName)) {return "The package does not exist in Artifactory"}
This script gets the value of the "Package Name" custom field from the issue and checks if the package exists in Artifactory using the artifactory.packageExists() method. If the package does not exist, the script returns an error message that will be displayed to the user.
artifactory.packageExists()
You need to change the custom field name with yours - should be working, if not..some minor tweaks will help
It looks like you're new here. Sign in or register to get started.