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

I have a KCF Single Autocomplete customfield. This customfield appears in Create screen and in transition1 screen. This customfield has a Datasource SIL script associated.


I need to launch a different sql in "create" transition and than in "transition1" transition.
The problem is that argv["screen"] returns "" in both cases and I don't know how specify in the datasource sil script this case.

I thought to do something like that:

query += "SELECT c.servicio";
if (argv["screen"]=="create"){
	query += " from vmmet_catalogoactivo c, vmmet_grupos g";
	query += " where c.issue_id=g.issue_id and";	
}
else {
	query += " FROM vmmet_catalogoactivo c";
	query += " WHERE ";
}
query += " c.proy_key='"+proyecto+"'";

But argv["screen"] returns always null. 

Anyone knows how can I do this?

2 answers

1 accepted

Hi Begoña,

 

As long as you have JJUPIN installed & enabled, argv["screen"] should always return the right values (view/create/edit/trans_x).

Have you tried to set the log level on DEBUG and check why is the value of the screen coming wrong?

 

Best Regards,
Alexandra 

 

I've added the results in log. Do you find any clue?

Hi,

I've seen your comment. My bad, I forgot that you're not using this via Live Fieds, but via KCF Pro.

That's why it doesn't work: KCF Pro only knows how to get the values for the dependent fields.

Unfortunately, I think that at the moment there's no way to get the screen value on a datasource. sad

Ok Alexandra, then I'll use a customfield to charge on it an specific value depending on the transition and then I'll define it as dependen field for the KCF. It's a trick but I think it'll work.

Yes, this should work. Good luck!

It doesn't work........

I can see the customfield with value on the screen but the argv returns "" also......

My code:

In Main script:

if (arrayElementExists(transCAMBIAR_GRUPO_SOPORTE, pantalla))
{
    lfInstantHook({"project"}, "/datos_apl/jira/silprograms/proyectos_soporte/transiciones/trans_cambiarGrupoSoporte/cargaInicial_trans_cambiarGrupoSoporte.sil");
}

 

In cargaInicial_trans_cambiarGrupoSoporte.sil:

lfSet("cf_TRANS","CGS");

 

In datasource:

string   transicion=argv["customfield_25800"]; //TRANS customfield
string[] resultado;
string   query="";
string   tipos_de_grupos="";
string   id_servicio_issue      = #{SERVICIO_ISSUE};
if (transicion=="CSC"){
	tipos_de_grupos="'A','EI','EESS'";
}
if (transicion=="CGS"){
	tipos_de_grupos="'EI','EESS'";
}
if (transicion=="ECS"){
	tipos_de_grupos="'EECS'";
}		
query += " Select distinct grupo ";
query += " From vmmet_grupos";
query += " Where issue_id="+id_servicio_issue;
query += " and tipo_grupo in ("+tipos_de_grupos+")";
query += " and proy_key='"+proyecto+"'";
resultado = sql("JiraDB",query);
return resultado;

 

And the result in log:

2016-06-17 14:28:40,380 http-bio-8080-exec-16 ERROR bonet_beg 868x37797x1 2m6kma 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.routines.SQLRoutine] Could not execute SQL >>Select distinct grupo  From vmmet_grupos Where issue_id=224256 and tipo_grupo in () and proy_key='SIP'<< on database JiraDB.

 

Any idea?

The KCF PRO is with autocomplete, isn't it?
Have you added the new field as a dependent one? Is the new field a simple text field? 

Sorry! It was my fault!

I'll need to incluye TRANS customfield as Dependent customfileld and now it works!!

smile

I've included the "logprint" clause in the code:

logPrint("DEBUG", "THE SCREEN IS = " + argv["screen"]);
query += "SELECT c.servicio";
if (argv["screen"]=="create"){
    query += " from vmmet_catalogoactivo c, vmmet_grupos g";
    query += " where c.issue_id=g.issue_id and"; 
}
else {
    query += " FROM vmmet_catalogoactivo c";
    query += " WHERE ";
}
query += " c.proy_key='"+proyecto+"'";

 

And in log file this is the result:

2016-06-15 08:53:54,575 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTBinaryOpNode] Interpreting PLUS node >>argv<<, line : 39, column 40
2016-06-15 08:53:54,575 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTValueNode] Interpreting VALUE node >>THE SCREEN IS = <<, line : 39, column 19
2016-06-15 08:53:54,575 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTValueNode] Interpreting VALUE node >>screen<<, line : 39, column 45
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTFieldNode] Getting variable named : 'argv'.
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [jira.commons.ivm.IssueVariableResolver] Issue variable resolver: Retrieving variable >>argv<<
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [keplerrominfo.sil.lang.VariableResolver] Found variable in context [0]
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [keplerrominfo.sil.lang.VariableResolver] Attempting to retrieve variable >>argv<<, com.keplerrominfo.jira.commons.ivm.DefaultIssueVariableResolver, context[0]
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [keplerrominfo.sil.lang.VariableResolver] Found variable in context [0]
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [keplerrominfo.sil.lang.VariableResolver] Current value is: [STRING[]] {, , , , , , , , , , , , , , , , , , , , ,  #keys: customfield_23701->0, customfield_24900->21, customfield_24901->20, customfield_23703->3, customfield_20001->18, customfield_17300->4, customfield_22110->15, query->5, customfield_17700->17, description->1, project->2, customfield_19116->13, customfield_19117->14, customfield_14214->12, customfield_13205->19, cf_SeleccionarCiAfectadoSW->10, customdield_22904->6, customfield_14703->16, customfield_20806->11, customfield_20901->9, customfield_20900->8, customfield_21500->7}
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [jira.commons.ivm.IssueVariableResolver] Issue variable resolver: >>argv<< is already defined or even used as >>argv<<
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTCallNode] Interpreting CALL node >>logPrint<<, line : 39, column 1
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.grammar.ASTCallNode] CALL >>logPrint<<, parameter list size = 2
2016-06-15 08:53:54,576 http-bio-8080-exec-6 DEBUG bonet_beg 533x7848x1 19h66wp 10.178.169.22,10.178.169.22,172.27.146.22 /rest/keplerrominfo/kcf-pro/latest/optionscf/autocomplete [sil.lang.routines.LogPrintRoutine] THE SCREEN IS =

Suggest an answer

Log in or Join to answer
Community showcase
Teodora [Botron]
Published Feb 15, 2018 in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

1,084 views 6 19
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot