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.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
// Get the custom field that contains the package name
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField packageField = customFieldManager.getCustomFieldObjectByName("Package Name")
// Get the package name from the issue
def packageName = issue.getCustomFieldValue(packageField)
// Check if the package exists in Artifactory
if (!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.
You need to change the custom field name with yours - should be working, if not..some minor tweaks will help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.