Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I am trying to add a behaviour to Time Spent field to restrict the entries

Used the below code for the same, but it is not working, Any help will be appreciated,Where can I see the logs?


import com.atlassian.jira.component.ComponentAccessor

import com.onresolve.jira.groovy.user.FormField

import com.onresolve.jira.groovy.user.FieldBehaviours

import groovy.transform.BaseScript


@BaseScript FieldBehaviours fieldBehaviours




def tsvalue = getFieldById(getFieldChanged()). getValue()

if(tsvalue.endsWith(’m’) && toInteger (tsvalue.minus(“m”))< 15)  {

getFieldById(getFieldChanged()).setError(“Value is not proper”)


if(tsvalue.endsWith(’h’) && toInteger (tsvalue.minus(“h”)) > 8)  {

getFieldById(getFieldChanged()).setError(“Value is not proper”)


1 answer

1 accepted

0 votes
Answer accepted
Sarika Dalal Community Leader Dec 06, 2021

Hi @Soumya Rajeshkumar ,


To see the logs for the behavior script please import logger package like 

import org.apache.log4j.Level
import org.apache.log4j.Logger

def myLog = Logger.getLogger("com.jira.groovy.behaviour")

myLog.debug(" Custom message write here")

Thanks a lot, but the script is not working . Need a solution for that also

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

384 views 1 6
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you