Forums

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

Use behaviour to hide fields on transition screen

Andy Hurley
Contributor
June 14, 2019

This is probably a silly question but I am trying to use behaviours to hide certain fields on an issue type and it seems to work during issue creation but not on transition screens.

I am trying to build a timesheet workflow and want to hide the days that are not appropriate if the week ending is not a Friday so I have behaviour code like this (actually one for each day of the week):

 

def dayField = getFieldByName ("Sunday")
def weekEnding = getFieldByName ("Week Ending").getValue() as Date
def weekCalendar = weekEnding.toCalendar()

def dayOfWeek = weekCalendar[weekCalendar.DAY_OF_WEEK]
def dayOfMonth = weekCalendar[weekCalendar.DAY_OF_MONTH]

if ((dayOfMonth - dayOfWeek + 2)>0 && (dayOfWeek >= weekCalendar.SUNDAY)) dayField.setHidden(false)
else dayField.setHidden(true) 

This hides Sunday if it does not fall in the same month as the week ending field but when I use a transition screen (needed to edit the timesheet so that I can prevent other users editing someones timesheet) all the days show up.

What am I doing wrong or can't behaviours work on transition screens? I have even tried just forcing the field to be hidden (in case my logic is wrong) but it still shows up on the transition screen.

1 answer

0 votes
Ilya Turov
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.
June 14, 2019

>or can't behaviours work on transition screens?

pretty sure they can. are you putting your script in initialiser or in a field behaviour? because if the latter, the field you put it in might be absent

if the former and it still doesnt work, try specifying the "Guide workflow", at least thats how it works for me

Suggest an answer

Log in or Sign up to answer