Could you tell us what you are trying to do? Not how, but what?
Problem is you've said "create issue in Jira SR using REST API" - if you have SR, you don't need to use REST, you have direct access to the Jira you are in. But you might also mean you're trying to create issues from somewhere else (in which case, you might not need SR, as Jira has a REST interface).
We can clarify what the question is and hence get started on a proper answer.
Hi Nic,
The requirement is when an issue of type Risk is moved to the workflow state of 'Occurred' then validate whether any issue of type "issue" is linked with the parent issue t "Risk", if yes then nothing will happen if no then we need to create an issue of type issue, and the Summary,description from the Risk is used as the Summary,description of the Issue.
I am trying to write the groovy script in validator custom script.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, so nothing to do with REST.
I would do this with a post-function. You should NEVER try to make changes to anything in a validator - a validator is part-way through a process and should only ever say "yes, this is ok", or "no, your data does not fit, so we will not be proceeding with the transition". If you were to put issue updates in a validator, you will start finding them doing very odd things and possibly trashing your database.
So, a post-function on the "go to occurred" transition of the Risk workflow would need to
Go through the links on the current issue
Check if the far end is of type "issue"
If you cannot find one, then create one, copying summary and description from current issue
These two should help you put together code for that:
https://library.adaptavist.com/entity/check-for-duplicate-link-when-resolution-is-duplicate
https://library.adaptavist.com/entity/automate-the-creation-of-an-issue-in-jira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Nitu Kumari
It depends on what kind of scenario you're scripting for.
I would suggest starting on Scriptrunner's wiki - click here to view it - you could achieve this with a listener or post-function, both of which have instructions and examples within their wiki :)
Ste
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.