How to set value in dropdown field

AkashD June 21, 2016

Hi,

 

I am trying to set value on dropdown field based on value selected on cascade filed.

Example :-  If (cascade filed_parent  == Test1 && cascade filed_chiled == Test2 ) then ETA_field = 1day


How can I achieve this using SIL setup 

 

1 answer

1 accepted

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.
June 21, 2016

Hi,

 

Cascading selects are returning string [], so simply do like this:

if  (customfield_xxxxx[0]  == "Test1" && customfield_xxxxx[1] == "Test2" ) {
customfield_yyyyy = "1d";
}


Hope this helps,
Alexandra 

 

AkashD June 21, 2016

Thanks Alexandra for the response but unfortunately this seems to be not working

What I did is :-

Created new Live Fields and point this script from SIL Manager

Is there anything I missed out please assist

 Also I want ETA_field should not be edited after set the value. ex. 1d

AkashD June 21, 2016

Hello Alexandra,

Please assist me how do i create Live fields configuration for above script work 

currently I am using 

Live Fields configuration as :-

lfInstantHook("customfield_16205", {"customfield_16205", "customfield_16302"}, "mandat.sil");

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.
June 21, 2016

Hi,

 

The fact that you're using it in live fields changes a little bit the situation.

You'll need two scripts: a hook and an execution script. They should look like below:

lfWatch({"customfield_xxxxx"}, {"customfield_xxxxx"}, "hook.sil");
lfInstantHook("customfield_xxxxx", "hook.sil");
string value = argv["customfield_xxxxx"];
string firstValue = substring(value, 0, indexOf(value, "|"));
string secondValue = substring(value, indexOf(value, "|")+1, length(value));
if (firstValue == "opt2" && secondValue == "2") {
    lfDisable("estimate");
    lfSet("estimate", "1d");
} else {
     lfEnable("estimate");
}

Don't forget to attach the live fields configuration on the project. smile

 

Alexandra 

AkashD June 21, 2016

Thanks, Alexandra   you are awesome...!   the script is working flawlessly.

I really appreciate your help  thank you very much.

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.
June 21, 2016

I'm glad it helps. In this case, please mark the answer as accepted. smile

AkashD June 23, 2016

Hello Alexandra, 

One more problem with estimate field if I will create the issue on a new tab it will not disabling the estimate field but the value is set as per the cascade field. How do I disable this estimate on all type of create screen please assist

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.
June 26, 2016

Hi,

 

This should not happen. Could you please check the JS console?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events