Hi Team,
I would like to know how we get the workflow transition name,
I am trying to update the custom field when workflow transition action is performed.
def eventTypeManager = ComponentAccessor.getEventTypeManager()
def eventTypeName = eventTypeManager.getEventType(event.eventTypeId).getName()
log.info('Event Type Name:' + eventTypeName)
if(eventTypeName == 'Generic Event' && transitionName == 'Refresh')
{
//Update custom field value
}
else{
exit
}
Thanks
hello @Teja ,
You could use the transition id. If the name of the transition change, the Id won't.
You can easily find the Id of you transition by going in workflow edition mode:
Thanks for your reply!
I am having a hard time getting the code for the transition ID, any idea?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Teja what do you mean by "having a hard time " ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the below code, it works for all the transitions, I want this to run on a particular actionId is 591
def eventTypeManager = ComponentAccessor.getEventTypeManager()
def eventTypeName = eventTypeManager.getEventType(event.eventTypeId).getName()
log.info('Event Type Name:' + eventTypeName)
def actionId = 591
def issueService = ComponentAccessor.issueService
def user = ComponentAccessor.jiraAuthenticationContext.loggedInUser
def issueInputParameters = issueService.newIssueInputParameters()
def validationResult = issueService.validateTransition(user, issue.id, actionId, issueInputParameters)
if(eventTypeName == 'Generic Event' && validationResult)
{
//update
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Teja ,
The solution in that case would be :
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yep I have been trying the solution of getting transientVars, but could not able to resolve No such property: transientVars for class
def eventTypeManager = ComponentAccessor.getEventTypeManager()
def eventTypeName = eventTypeManager.getEventType(event.eventTypeId).getName()
log.info('Event Type Name:' + eventTypeName)
int actionId = 591
def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue)
def wfd = workflow.getDescriptor()
def actionName = wfd.getAction(transientVars["actionId"] as int).getName()
if(eventTypeName == 'Generic Event' && actionName == "Refresh")
{
//update
}
Error
groovy.lang.MissingPropertyException: No such property: transientVars for class: Script63
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.