Custom field Of Date/Time Picker is NULL on Create Transition

Hi Atlassians,

I developed a validator that checks if the value of a Custom Field is EMPTY and I have added this validator on the Create Transition of my WF.
But, when the Custom field is Of Date/Time Picker, the value is rendered NULL. This is something weird because if the Type is Free Text, I'm obtaining the value without any problem. In plus, my code works perfectly on other transitions. Is there something special from the type of field on the Create Level?
My snipped of code inside my validator is the following:

public void validate(Map transientVars, Map args, PropertySet ps) throws InvalidInputException, WorkflowException
    Issue issue = (Issue) transientVars.get("issue");
    CustomField customFieldParam = customFieldManager.getCustomFieldObject(Long.valueOf(13519));
    try {
        String currentCustomFieldParamValue = getCustomFieldStringValue(issue, customFieldParam);
    catch (Exception e)
    if( StringUtils.IsNotEmpty(currentCustomFieldParamValue))
        throw new InvalidInputException("Exception through Validator!");
public String getCustomFieldStringValue(Issue issue, CustomField customField) throws Exception {
    String customFieldStringValue = "";
    Object value = issue.getCustomFieldValue(customField);
    if(value == null){
        customFieldStringValue = "";
    else if(value instanceof Option) {
        customFieldStringValue = ((Option) value).getValue();
    else if(value instanceof String) {
        customFieldStringValue = (String) value;
    else if(value instanceof java.sql.Timestamp)
        Date date = (Date)(customField.getValue(issue));
        DateFormat localDateFormatWithoutSeconds = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        customFieldStringValue = localDateFormatWithoutSeconds.format(customfieldDateInUserTimeZone);
    log.debug("Custom Field " + customField.getName() + " has the following string value: " + customFieldStringValue);
    return customFieldStringValue;

===> In Summary, getValue of customfield is rendering NULL on CREATE transition only for Date/Time types

1- 13519 is the ID of my Date/Time Custom Field
2- In getCustomFieldStringValue function, when value is instanceof String, everything is OK. The problem is with instanceof java.sql.Timestamp.


1 answer

Hi again guys,

I was able to fix it by replacing: Date date = (Date)(customField.getValue(issue)); 


Date date = (Date)(issue.getCustomFieldValue(customField));

Apparently, customField.getValue(issue) is not working with Date/Time CF onCreate Transition.




Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,334 views 14 20
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot