Hi Community,
My use-case is:
1) There are 2 different workflows: Parent (Initiative - issuetype) WF and Child (Portfolio Epic - issuetype) WF. Parent issue and Child(ren) issue(s) is/are linked by Parent field (present on Child)
2) We are following Work Type Hierarchy (Initiative - level 3 > Portfolio Epic - level 2 > Feature - level 1 > Story > Sub-tasks) in Jira Software Cloud.
3) Conditions need to be added in code:
- If Parent (Initiative - issuetype) is IN "Done" status in Parent WF and ALL it's Child(ren) (Portfolio Epic - issuetype) are IN "Done" in Child WF - Then 2 custom fields: SelectList 1 and TextField1 should be visible to a user (who is part of User Group) on the Parent issue.
- If Parent is NOT in Done and ANY of it's child are NOT in Done - Then 2 custom fields should be hidden to user.
- If Parent is IN in Done and ALL it's Child(ren) are NOT in Done - Then 2 custom fields should be in ReadOnly mode for the user.
Please provide a sample code on how to achieve the above conditions on scriptrunner behavior in Jira Software Cloud.
Thanks
Hi @Ram Kumar Aravindakshan _Adaptavist_
Reaching out to you for your help and assistance.
May you guide me further to achieve the mentioned request?
I was able to achieve my request in Groovy in Scriptrunner Behavior in DC where I have used the concept of:
//For every child(ren) of a Parent issue - When Parent is in Done and every Child(ren) is in Done
issueLinkManager.getOutwardLinks(underlyingIssue.id)?.every
{issueLink ->
if(issueLink.issueLinkType.name == "Parent-Child Link")
{if(parentIssueTypeName == "Initiative"
&& parentStatusName == "Done"
&& issueLink.destinationObject.issueType.name == "Portfolio Epic"
&& issueLink.destinationObject.status.name == "Done")
{selectField1.readOnly = false}}}
//For each Child(ren) of a Parent issue - When Parent is in Done and each Child is not in Done
issueLinkManager.getOutwardLinks(underlyingIssue.id)?.each
{issueLink ->
if(issueLink.issueLinkType.name == "Parent-Child Link")
{if(parentIssueTypeName == "Initiative"
&& parentStatusName == "Done"
&& issueLink.destinationObject.issueType.name == "Portfolio Epic"
&& issueLink.destinationObject.status.name != "Done")
{selectField1.readOnly = true;
selectField1.formValue = null}}}
Could you help in translating/ recoding the above from Groovy to Typescript/Javascript for Scriptrunner Behavior on Jira Cloud?
It would be great if you can share any sample code as it will help to build the further logic accordingly.
Thanks in advance.
Hi @Digvijay Singh Gehlot , thanks for your post.
I don't think this is something that someone is going to write for you, as this requirement, for me anyway, would be considered paid work.
Please have a look here at the example scripts that ScriptRunner provides. Here is one I think could be helpful for you - https://www.scriptrunnerhq.com/help/example-scripts/filter-resolution-for-issue-type-cloud
How we usually work in the forums is that people show us what they have so far and ask for help, rather than asking us to provide a script for you.
Please have a go at creating something and ask for help when you get stuck.
Cheers
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.