It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Database Custom Field not working with custom field parameter

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

1 vote
Answer accepted

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 

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.

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

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

Yes, set it on debug.

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

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!

Hello
Can you explain this solution better?

Thanks

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published yesterday in Confluence

Confluence CVEs and common questions

Two vulnerabilities have been published for Confluence Server and Data Center recently: March 20, 2019 CVE-2019-3395 / CVE-2019-3396 April 17, 2019 CVE-2019-3398 The goal of this article is...

63 views 0 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