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 Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

966 views 3 9
Read article

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