You need to sign in to do that
Don't have an account?

Global chekbox to control a logic of function execution
Hello,
I want to create a global checkbox which if true will exute code block one.
What is simplest way to achieve it , please ?
I want to create a global checkbox which if true will exute code block one.
What is simplest way to achieve it , please ?
If(Global checkbox == True){ @AuraEnabled(cacheable=true) public static string FucntionName(){ //Logic } }else{ @AuraEnabled public static string FucntionName(){ //Logic } }thank you for advice
Greetings!
In order to achieve this you would need to create the global picklist field on UI then you can use it in the apex class to run the code based on the value of the picklist value:
https://help.salesforce.com/apex/HTViewHelpDoc?id=sf.fields_creating_global_picklists.htm&language=th
https://developer.salesforce.com/forums/?id=9060G000000XZmkQAG
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
All Answers
Greetings!
In order to achieve this you would need to create the global picklist field on UI then you can use it in the apex class to run the code based on the value of the picklist value:
https://help.salesforce.com/apex/HTViewHelpDoc?id=sf.fields_creating_global_picklists.htm&language=th
https://developer.salesforce.com/forums/?id=9060G000000XZmkQAG
Please mark it as best answer if it helps you to fix the issue.
Thank you!
Regards,
Shirisha Pathuri
You can use a Input element of checkbox type, associate its value = true/false to JS controller and use it for verification in method. Input checkbox value can be updated in JS Contorller using "onchange" event method on input checkbox, event(event.target) passed in onchange event handler method will provide details about checkbox element.
Thanks