I have created a custom field with name 'Begin Date' which is type of Date Picker. In my work flow I want to put the post function that as soon as I make a transition of issue from Created to In-progress, Begin Date should populate with Current Date.
I tried with custom script in Script Runner but failed. Help please?
Hello,
You can find an answer here:
Thanks Alexey.
But I got
Error occurred while creating issue. This could be due to a plugin being incompatible with this version of JIRA. For more details please consult the logs, and see: http://confluence.atlassian.com/x/3McB java.sql.Timestamp cannot be cast to java.lang.String
It seems that you have tried to perform an illegal workflow operation.. any idea??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the type of your custom field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One custom field is Date Picker and another is Text Field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
According to the error you are trying to save the date into your Text Field
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, you are right. When I tried with date picket it worked. Is there any way we can convert it to String and add it to text field as well.
Thanks for all the help here..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Final script I used is
import com.atlassian.jira.component.ComponentAccessor
import static java.lang.Math.*
import java.sql.Timestamp
def Begin_Date = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Begin Date")
// get today's date
issue.setCustomFieldValue(Begin_Date, new Timestamp((new Date() + 1).time))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can convert the date to a string like this:
new Timestamp((new Date() + 1).time.toString()
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Chandan Gupta,
You can edit the date custom field configuration an check the Current Date option.
In addition, you can use the Suite Utilities for Jira app in the postfunction and add the Update Issue Custom Field in order to add the current date in that specific transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.