Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Get custom filed value to variable - JJUPIN script

Miroslav Brabenec July 15, 2015

I have such .sil script:

if (argv["customfield_10705"]!="" || argv["customfield_10800"]!="") {
    string #{sum} = customfield_10705+customfield_10800;
    lfSet("summary",sum,true);
    
 }

But I would like to get value from custom field customfield_10705 and customfield_10800 to sum variable and it do not work. It only works like string, but i need values from this custom field, not string "customfield_10705"+"customfield_10800".

string #{sum} = "customfield_10705"+"customfield_10800";

My goal is to set value from customfield_10705 joined with value from customfield_10800 to Summary.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
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.
July 15, 2015

Hi Miroslav,

You will have to use lfWatch and lfInstantHook (for create screen) routines. Your scripts should look like this: 

lfWatch("customfield_10705", {"customfield_10705", "customfield_10800", "summary"}, "hook.sil");
lfWatch("customfield_10800", {"customfield_10705", "customfield_10800", "summary"}, "hook.sil");
lfWatch("description", {"customfield_10705", "customfield_10800", "summary"}, "hook.sil");
lfInstantHook({"customfield_10705", "customfield_10800", "summary"}, "hook.sil");



if (argv["customfield_10705"]!="" || argv["customfield_10800"]!="") {
//   string #{sum} = argv["customfield_10705"] + argv["customfield_10800"];
    //for strings -> 2 + 3 will be 23
   string #{sum} = customfield_10705 + customfield_10800;   
    //for numbers -> 2 + 3 will be 5
   lfSet("summary", sum);
}

 

Hope this helps,
Alexandra 

Miroslav Brabenec July 15, 2015

Thanks, it works great!!!

0 votes
Raluca Panait
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.
July 15, 2015

Hi Miroslav,

If you want to set the summary of an issue with the values of the 2 custom fields, you can use the script below:

if (key.customfield_10705 !="" || key.customfield_10800!="") {
   string sum = #{customfield_10705} + #{customfield_10800};
   lfSet("summary",sum,true);    
}

 

Regards,

Raluca

0 votes
Błażej O_
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.
July 15, 2015

Have you tried:

 

number #{sum_number} = customfield_10705 + customfield_10800;
string #{sum_string} = sum_number;
lfSet("summary",sum_string,true);

 


Miroslav Brabenec July 15, 2015

Thanks, but is the same problem. It looks like, that value from custom field, is not able to save into variable.

TAGS
AUG Leaders

Atlassian Community Events