jqlclausebuilder textfield and date

Hello

customFieldhclass is a single line text field and I get error = is not valid

and for date I get the error "

// get this error Date value '18/Jan/16' for field 'created' is invalid. Valid formats include: 'yyyy/MM/dd HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy/MM/dd', 'yyyy-MM-dd', or a period format e.g. '-5d', '4w 2d'."

 

In atlassian-plugin.xml I have date as

<property>
<key>todt</key>
<name>To Date</name>
<description></description>
<type>date</type>
</property>

 

Please let me know:

Which function in jqlClausebuilder should I use to get ~ ( assuming ~ is the way to compare content of Single Line Custom Text Field)

For date should I pass it to some date formatter, any code snippet is appreciated.

Thanks

Abe

 

.customField(customFieldhclass.getIdAsLong()).eq(hclass)  // How to compare text filed single line eq does not work need ~
        		.createdBetween(startDate, endDate);  // get this error Date value '18/Jan/16' for field 'created' is invalid. Valid formats include: 'yyyy/MM/dd HH:mm', 'yyyy-MM-dd HH:mm', 'yyyy/MM/dd', 'yyyy-MM-dd', or a period format e.g. '-5d', '4w 2d'.

2 answers

1 accepted

for ~ we should use .like

Figured out date part

Date startDate = ParameterUtils.getDateParam(searchParams, "fromdt", i18nBean.getLocale());
Date endDate = ParameterUtils.getDateParam(searchParams, "todt", i18nBean.getLocale());

.createdBetween(startDate, endDate);

Just need to figure out how I can get ~ for comparing text value

String ha = ""+searchParams.get("ha");

.customField(customFieldHa.getIdAsLong()).eq(ha);

I should get it as ~ for my query to work, = that .eq is producing is not working.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published yesterday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

66 views 0 5
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