Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Database Custom Field not working with custom field parameter

Dave Scheet May 12, 2016

I have a query where I want to add a static row to a return.  I am doing a UNION to add in the extra row.  Below is the query.  It returns data just fine when i hardcode 526595 for the customfield value

 

SELECT
p.program_name AS pname,
p.program_key AS pkey
FROM
program p
WHERE
p.client_number = {customfield_10428}
UNION
SELECT
"ALL PROGRAMS" AS pname,
p.client_number AS pkey
FROM
program p
WHERE
p.client_number = {customfield_10428}

 

Is there something wrong with my query when I change to a custom field?  Also, when i try to revert back to one that worked prior, it errors out for a bit.  Does something cache the config for a bit?   Is there a log I can check?  Nothing is showing in the atlassian-jira.log file.

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 12, 2016

Hi Dave,

What type of custom field is customfield_10428? You can see the supported fields for dynamic queries here:  https://confluence.kepler-rominfo.com/pages/viewpage.action?pageId=4161561

 

Best Regards,
Alexandra 

Dave Scheet May 13, 2016

It is a text field.  the program_key field is an integer.  I tried doing CAST({customfield_10428} as INT).  It worked when querying the DB (using '526595' for the custom field) just fine.

SELECT
p.program_name, p.program_key
FROM
program p

WHERE
p.client_number = {customfield_10428}
order by p.program_name asc

 

This exact query works from one server, but not another.  There are other connections to the database that are working on both servers.

Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2016

Try to set the log level to DEBUG as described here: https://confluence.kepler-rominfo.com/display/JJUP30/Configure+JIRA+Logging and check for some relevant information. smile

Dave Scheet May 13, 2016

Is there a specific logging level I can turn on/up to see what is being sent to the database?

Alexandra Topoloaga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 13, 2016

Yes, set it on debug.

Dave Scheet May 13, 2016

i tried debug and trace.  I am not seeing my query anywhere in atlassian-jira.log

Dave Scheet May 13, 2016

well, it was a stupid plugin trick (I refuse to call it a stupid HUMAN trick here)

That custom field was not on the screen, even though it was being populated on the back end.  Adding it to the screen fixed it.

 

Resolving as turning up the logging helped identify.   Thanks!

Francesco Mazza December 21, 2017

Hello
Can you explain this solution better?

Thanks

TAGS
AUG Leaders

Atlassian Community Events