Execute script based on condition on another field

Asmita7
Tera Expert

Hello friends,

 

I am working on a script.

My requirement is that  :

1. when the is not selected then field should populate set of records.

2. when the is selected then field should populate different set of records.

 

How to achieve this.

3 ACCEPTED SOLUTIONS

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Asmita7 ,

You can write the script include and call in reference qualifiers.

 javascript : new ScriptIncludeName().FunctionName(g_form.getValue('CheckBoxFieldname');

Script include should be client-callable

getRecordsIDs: function(a){
//Parameter 'a' will contain the checkBox value
if (a==true)

{

// execute the true value logic and return records

}

else

{

// execute the false value logic and return records

}

},

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

View solution in original post

Unique45
Mega Sage

Hello @Asmita ,

To achieve this, you need to add an advanced reference qualifier to the reference variable.

Please refer below screenshot:

Pratiksha_PP_0-1701607135141.png

And through script include you need to return the records according to your requirement.

 

If my answer sloved your problem then please mark as Accepeted Solution and give thumps up.

 

Please mark correct/helpful if this helps you!

View solution in original post

Anwesha3
Mega Guru

Hi @Asmita7 
Option 1 -
You can create on Change client scripts that will execute on change of check box field . and do glideAjax to populate expected records. 

Option 2 -

write a script include and call that reference qualifier as -

 javascript &colon; new <ScriptIncludeName()>.functionName(current.variables.<variableName of check box field>)
on script include side check the variable value if true or false , execute script as expected.
Option3 - 

( Not so technically strong but easy to implement)

Create 2 reference fields with same label name , one for Check box true condition and another for false. add respective  reference qualifier as needed .

Write an ui policy to make either of them visible for needed condition.


Kindly consider marking the provided answer as correct if it proved helpful or mark helpful if it has contributed in someway to your query 


Thank you and best regards,
Anwesha

 

View solution in original post

3 REPLIES 3

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @Asmita7 ,

You can write the script include and call in reference qualifiers.

 javascript &colon; new ScriptIncludeName().FunctionName(g_form.getValue('CheckBoxFieldname');

Script include should be client-callable

getRecordsIDs: function(a){
//Parameter 'a' will contain the checkBox value
if (a==true)

{

// execute the true value logic and return records

}

else

{

// execute the false value logic and return records

}

},

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Unique45
Mega Sage

Hello @Asmita ,

To achieve this, you need to add an advanced reference qualifier to the reference variable.

Please refer below screenshot:

Pratiksha_PP_0-1701607135141.png

And through script include you need to return the records according to your requirement.

 

If my answer sloved your problem then please mark as Accepeted Solution and give thumps up.

 

Please mark correct/helpful if this helps you!

Anwesha3
Mega Guru

Hi @Asmita7 
Option 1 -
You can create on Change client scripts that will execute on change of check box field . and do glideAjax to populate expected records. 

Option 2 -

write a script include and call that reference qualifier as -

 javascript &colon; new <ScriptIncludeName()>.functionName(current.variables.<variableName of check box field>)
on script include side check the variable value if true or false , execute script as expected.
Option3 - 

( Not so technically strong but easy to implement)

Create 2 reference fields with same label name , one for Check box true condition and another for false. add respective  reference qualifier as needed .

Write an ui policy to make either of them visible for needed condition.


Kindly consider marking the provided answer as correct if it proved helpful or mark helpful if it has contributed in someway to your query 


Thank you and best regards,
Anwesha