I want to know how to set a date picker custom filed to the current day? I tried a lot of way but no one works.
For example:
Date now = new Date()
Date cfDate = new Date(cfValues['DateFieldA'].getTime())
or
issue.setCustomFieldValue('DateFieldA', new Date())
Thanks very much!!
Take a look, which object you get if you get the custom field value and try to submitt an object of the same class while setting the custom field.
To get the class of the returned object use this
log.error cfValues['DateFieldA']?.class?.name
In this case I assume it's a Timestamp. If this is correct, you can try
issue.setCustomFieldValue(cf, (new Date()).toTimestamp())
cf is the customfield not the name of the customfield. See my comment here to see how to get the customfield object.
After updating the issue normally you have to save the issue, see here on how to do this.
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.