I would like set a default value for Time Spent field by setFormValue function by using behaviour.
I've tried the code below but it does not work properly. Is there any suggestion?
@BaseScript FieldBehaviours fieldBehaviours
String className = "tr.com.as.behaviour.OysmSetTimeSpent10Min";
Logger logger = Logger.getLogger(className);
logger.debug ("Script " + className + " started");
def timeSpent = getFieldByName("Time Spent");
Jira Version: 8.5.4
Script Runner Version: 6.19.0
Not sure what else to tell you.
Have you looked at your logs? Are there any errors?
With the simplest of behavior:
I see this on my screen (have to put the "Log work" field on the screen and check the box during the transition to view the default value):
I also tried with your code as below but same result for me. It still does not get 10m into the screen. (Even I've removed the mapping.)
Below is my screen.
BTW we're using WorklogPRO plugin for logging work, so probably that's why I do not see "Log Work" checkbox on my screen.
Anyway, I see "log-work-time-logged" ID in Inspect element in Chrome.
worklogPreEntryParameters.timeSpent = "10m"
PS: This only works "Log Work Custom Field" of WorklogPRO and "Log Work Dialog" of WorklogPRO. It doesn't work for build-in time tracking field or "Log Work Dialog" of Jira itself.
Thanks for your reply.
It works as you mentioned in "Log Work Dialog" as expected, so I want to be able to use this in a transition but not able find the field "Log Work Custom Field", there is only one field which named "Log Work" and it seems that it is belong to "System Field", so could you explain me how can I add this field into a screen and can use for only the specific transition?
Calling all Confluence Cloud Admins! We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...
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