Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

If linked issue then dont execute script on workflow

Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

We have a script that executes on the create transition of our workflow. This basically makes the user add a custom field. The problem we have is when they create this issue via the 'create linked issue' button the custom field is not on that screen hence they cannot create the case.

I know the linked issue screen cannot be changed, so is there a condition i can add to the script to stop it executing if the issue is created via the 'create linked issue'?

import com.atlassian.jira.component.ComponentAccessor
import com.opensymphony.workflow.InvalidInputException

def customFieldManager = ComponentAccessor.getCustomFieldManager();
def CustomFieldValue1 = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Retailer ID"));

if(CustomFieldValue1 == null) {
def CustomFieldValue2 = issue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Retailer ID List"));

if(CustomFieldValue2 == null){
invalidInputException = new InvalidInputException("Retailer ID Mandatory")
}
}

 

1 answer

1 vote
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

You can hide the button using ScriptRunner web fragments: Hide system or plugin UI element

Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

Hide the 'create linked issue' button?

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

Yes. You can write a condition for which project and issue types to hide

Rob B
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 12, 2018

Thats an option to have i guess. Cheers Alexey!

Suggest an answer

Log in or Sign up to answer