Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Make the field mandatory based on value of the another field-SIL script

Madhura A S
Contributor
October 30, 2018

Hi ,

I am trying to make a custom field mandatory based on the value of another custom field using SIL script.

if (argv["customfield_17000"] == "Digital ad" ){
   lfShow("customfield_18600"); //Gifs or HTML5
   lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
   lfShow("customfield_18601"); //Maximum file size
   lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
  lfDisable("editSubmit");

}

lfWatch("customfield_17000", {"customfield_17000"}, "/path/SetSubtasks.sil");

But submit button is not getting disabled. Please help me to resolve this

1 answer

1 accepted

1 vote
Answer accepted
Alexey Matveev
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.
October 30, 2018

Hello,

Could you change you script to this one and have a look in the atlassian-jira.log file, what value is for customfield_17000:

logPrint("ERROR", "customfield_17000" + argv["customfield_17000"]);
if (argv["customfield_17000"] == "Digital ad" ){
   lfShow("customfield_18600"); //Gifs or HTML5
   lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
   lfShow("customfield_18601"); //Maximum file size
   lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
  lfDisable("editSubmit");

}

This script works on the Edit issue screen.

Madhura A S
Contributor
October 30, 2018

2018-10-31 01:56:41,800 http-nio-8080-exec-27 ERROR madhura.a 116x41794565x1 1rqn992 10.0.70.48,127.0.0.1 /rest/keplerrominfo/jjupin/latest/lf/event [c.k.s.lang.routines.LogPrintRoutine] customfield_17000Digital Animated ad

 

This is what i found on logs.

I want to disable create button in create screen. May be i will have to use different fieldname in this 

lfDisable("editSubmit");

Do you have any idea what value i can provide in place of "editSubmit". 

 

Regards,

Madhura

Alexey Matveev
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.
October 30, 2018

Your script should be like this:

logPrint("ERROR", "customfield_17000" + argv["customfield_17000"]);
if (argv["customfield_17000"] == "Digital Animated ad" ){
   lfShow("customfield_18600"); //Gifs or HTML5
   lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
   lfShow("customfield_18601"); //Maximum file size
   lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
  lfDisable("editSubmit");

}

If it does not work then try like this:

logPrint("ERROR", "customfield_17000" + argv["customfield_17000"]);
if (argv["customfield_17000"] == "Digital Animated ad" ){
   lfShow("customfield_18600"); //Gifs or HTML5
   lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
   lfShow("customfield_18601"); //Maximum file size
   lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
  lfDisable("createSubmit");

}
Madhura A S
Contributor
October 31, 2018
lfDisable("createSubmit");

Changing it to createSubmit did not work :(  

Alexey Matveev
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.
October 31, 2018

Could you try a script like this and make sure that there is the "inside the if" error message?

logPrint("ERROR", "customfield_17000" + argv["customfield_17000"]);
if (argv["customfield_17000"] == "Digital Animated ad" ){
logPrint("ERROR", "inside the if" + argv["customfield_17000"]);lfShow("customfield_18600"); //Gifs or HTML5
   lfShowFieldMessage("customfield_18600", "Field is required", "WARNING");
   lfShow("customfield_18601"); //Maximum file size
   lfShowFieldMessage("customfield_18601", "Field is required", "WARNING");
  lfDisable("createSubmit");

}

Madhura A S
Contributor
November 1, 2018

Hi Alexey Matveev,

Thanks for the reply. 

I raised support request and got the solution. We should use lfDisable("createIssueSubmit") or lfDisable("issueCreateSubmit")  depending from where we are accessing the screen

https://confluence.cprime.io/display/JJUPIN/Fields+and+graphic+elements+supported+by+Live+Fields#FieldsandgraphicelementssupportedbyLiveFields-1

 

Thanks & Regards,

Madhura

Alexey Matveev
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.
November 2, 2018

Thank you for letting know!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events