As I’m currently working for an IT Canadian company as JIRA administrator, I tried to set a specific form through our customer portal with some conditions but it doesn’t work for some reason, I tried to look for support but I didn’t know who to speak with.
So to make it clear, I’m currently using the sil to make it happen. I have both init.sil script run from the Live Field and hook.sil script.
Actually, I have three custom fields identified by their ID: company, project and subsidiary
Company: select list (single choice)
Project: checkboxes (I tried to use the select list with multiple choices before but it didn’t work)
Subsidiary: free form text (single line)
The idea is simple: when a user is filling the form through a portal, he has all the custom fields hidden at the beginning except the one for company, then when he selects a company, the project custom field appears and he has items restrictions based on the value of the first custom field (company). For a specific company and a specific project, he has the third custom field subsidiary appearing.
Everytime he comes back to default value from the company field (none), the project field and the subsidiary field are hidden again.
This would work for both creating and editing screens only.
The view screen should only display the information we entered from the custom fields.
Could you help me out please?
Thank you in advance.
init.sil:
if (argv["screen"] == "create" || argv["screen"] == "edit")
{
lfWatch("customfield_16798", "customfield_16798", "/temp_jira/atlassian/application-data/jira/silprograms/TEST/Custom-cascading-select-field/test2.sil", {"change"});
lfWatch("customfield_16797", {"customfield_16798", "customfield_16797"}, "/temp_jira/atlassian/application-data/jira/silprograms/TEST/Custom-cascading-select-field/test2.sil", {"change"});
}
hook.sil:
string v = argv["customfield_16798"];
if (v == "Groupe Optimum")
{
lfShow("customfield_16797");
lfShow("customfield_16799");
lfAllowSelectOptions("customfield_16797", {"Financiers"});
if (contains(argv["customfield_16797"], "Financiers"))
{
lfShow("customfield_16799"); // Indiquer la Filiale
lfSet("customfield_16799", "oui c'est bon");
}
}
else if (v == "INF")
{
lfShow("customfield_16797");
lfHide("customfield_16799");
lfSet("customfield_16799","");
lfAllowSelectOptions("customfield_16797", {"Confluence", "JIRA"});
}
else if (v == "OGI")
{
lfShow("customfield_16797");
lfHide("customfield_16799");
lfSet("customfield_16799","");
lfAllowSelectOptions("customfield_16797", {"PolicyCenter", "Syncra Claims", "Syncra Polices Habitations", "Polices Automobiles", "Polices Commerciales"});
}
else if (v == "ORE")
{
lfShow("customfield_16797");
lfHide("customfield_16799");
lfSet("customfield_16799","");
lfAllowSelectOptions("customfield_16797", {"DAVE", "GRP2"});
}
else
{
lfHide("customfield_16797");
lfHide("customfield_16799");
lfSet("customfield_16797","");
lfSet("customfield_16799","");
}
I also tried something easier with the swtich statement:
string v = argv["customfield_16798"];
switch (v)
{
case "Groupe Optimum":
lfShow("customfield_16797");
lfAllowSelectOptions("customfield_16797", "Financiers");
if (contains(argv["customfield_16797"], "Financiers"))
{
// argv["customfield_16799"] = "oui c'est bon";
}
break;
case "INF":
lfShow("customfield_16797");
lfAllowSelectOptions("customfield_16797", {"Confluence", "JIRA"});
break;
case "OGI":
lfShow("customfield_16797");
lfAllowSelectOptions("customfield_16797", {"PolicyCenter", "Syncra Claims", "Syncra Polices Habitations", "Polices Automobiles", "Polices Commerciales"});
break;
case "ORE":
lfShow("customfield_16797");
lfAllowSelectOptions("customfield_16797", {"DAVE", "GRP2"});
break;
default:
// lfHide("customfield_16797");
// lfHide("customfield_11997");
break;
}