Get "Created From" issue when creating a new issue from a postfunction Edited

W.hen Creating a particular issue "manually" we are requiring an issue link.

We also want to create the issue automatically from another Issue type transition. Due to the mandatory link requirement I am in a "chicken and egg" situation.

I would like to add to my script (scriptrunner) validator that checks for the links, to only validate the link when the "created from" issue is not a specific issue type.

I was trying to use getContextIssue, but this seems to only be available from behaviors, not workflows.

So when "Created From" = Issue type X, then do not validate links. If "Created From = null, then check for links.

I was going down this path, but getContextIssueId() does not resolve

def issueManager = ComponentAccessor.getIssueManager()
def cfId = getContextIssueId()
def contextIssue = issueManager.getIssueObject(cfId)

Any thoughts?

1 answer

This widget could not be displayed.

After looking at what is available, I went through the params map and it appears that if created manually the formtoken is supplied. If not, it is not in the params map.  I am now looking if the params contain the formtoken to determine whether to check for links or not.  Sort of hacky, but it is working.  If anyone has any other thoughts I would appreciate it.

if (request) {
     def params = request.getParameterMap()
     def paramsList = params.toString()
     log.debug("params: " + params)
     if (paramsList.contains("formToken")) {

          ....

     }

}

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Aug 06, 2018 in Jira Service Desk

A is for Activate: Share your top Jira Service Desk onboarding tips for new users!

Hi, everyone! Molly here from the Jira Service Desk Product Marketing Team :).  In the spirit of this month's  august-challenge, we're sourcing stories of Jira Service Desk activation fro...

565 views 25 15
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you