SIL Datasource: How can I make reference to the "project" value when creating an Issue?

I've defined a Kepler pro customfield with SIL script as datatource. This customfield belongs to several projects and for each project these values have to be differents.

Thus, when I'm creating an issue, I need to know the projet in the datasource SIL script to populate the kepler pro:

string query = "SELECT servicio";
query += " FROM table";
query += " WHERE proy_key='"+project+"'";

string[] resultado = sql("XXXDB",query);
return resultado;

The result in log is:

/proyectos_soporte/busqueda_serviciocatalogo/datasource_serviciocatalogo.sil<<
com.keplerrominfo.sil.lang.SILInfoException: [SIL Error on line: 1, column: 17] Script is not running in the context of an issue.Cannot get value for field project

How can I solve this problem?

 

Thanks in advance

 

1 answer

1 accepted

Hi,

First of all, you will need to add the project to Dependent Fields (from the kcf pro configuration).

Secondly, in the query, we will use project for edit screen and argv["project"] for create screen. However, this will return you the project name, so you will need to extract the project key from it.

The final script should be this one:

string x = isNull(argv["project"]) ? project : 	getProjectKeyByName(argv["project"]);
 
string query = "SELECT servicio";
query += " FROM table";
query += " WHERE proy_key='"+x+"'";
 
string[] resultado = sql("XXXDB",query);
return resultado;


Hope this helps,
Alexandra 

Thanks Alexandra! 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

59 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