Forums

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

Hide UI Element "Delete" when TimeSpent/Workloged != 0

Jurica Petricevic
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.
February 20, 2023

Hi Community,

 

I managed to hide the "delete" from the More Panel, but I can't write the Condition correctly, which will hide this element only on tickets that have a booked time. I imagined the script, but I need to get false whenever worklogged or timespent is greater than 0. Is this even possible?

 

Thanks in advance.

Best regards

1 answer

0 votes
David A
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.
February 20, 2023

Hi @Jurica Petricevic 

I think that is possible, try something like:

import com.atlassian.jira.issue.*
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.Worklog

def issue = context.issue as Issue
def workLogManager = ComponentAccessor.getWorklogManager()
def logged = workLogManager.getByIssue(issue)
if ( logged!=null || logged>0) { rturn true}
else return false

I hope this help!

Jurica Petricevic
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.
February 20, 2023

Hi David, thank you for you replay but we have a problem at the def issue

def issue = context.issue as Issue

For "issue" here is a Problem with 

Variable "issue" masks a binding variable of the same name. Please choose a different name for variable: "issue". Can we try to fix it?

Jurica Petricevic
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.
February 22, 2023

Hallo David,

i have it. This should be the Script that works 4 every one that searchs it its here:

 

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor

def workLogManager = ComponentAccessor.getWorklogManager()
def logged = workLogManager.getByIssue(issue)
if (logged != null && logged.size() > 0) { return false }
else return true
Like David A likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events