Questions tagged [switch]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
51 views

Need a way to create a switch case in apex emulating the java one without break

What I'm trying to accomplish is a switch case that in Java would result in a "cascade" behavior: switch(var) { case 'test': Log.d("inside test"); // break; ...
Frans's user avatar
  • 29
0 votes
0 answers
152 views

Switch Statement using boolean

I need to store the secret key value in protected custom setting which is exist under managed package. So we have class called SecretValueUser which have two method readSecret writeSecret Write secret ...
SFDC Akash's user avatar
1 vote
2 answers
279 views

Programmatic way to switch current selected app?

This is exactly the same question from here: Programmatic way to switch apps? However this solution is outdated and not working anymore. Is there any way to switch from the current selected app to ...
Julio Didier Maciel's user avatar
0 votes
1 answer
963 views

Variable does not exist when passing SObject as parameter to method

Refactoring code to merge similar operations and getting an error the SObjects I'm passing to this method are variables that do not exist. private static List<SObject> getSObjectList(SObject ...
nstuyvesant's user avatar
0 votes
1 answer
2k views

Can I perform a switch statement in AMPscript?

new SFMC user here. I'm just wondering if there's an equivalent of a javascript (or GTL) switch statement within AMPscript or if I'm restricted to using IF ELSE statements. For example, If I take the ...
marly's user avatar
  • 3
1 vote
1 answer
46 views

How to eliminate if/elseif/else chain for SObjectType variables? [duplicate]

In a few places I have code of this nature: private static void myMethod(SObjectType t) { if (t == Claim__c.SObjectType) xyzForClaims(); else if (t == Account.SObjectType) xyzForAccounts(); ...
Keith C's user avatar
  • 135k
12 votes
1 answer
5k views

Switch "when" cannot see constants?

I am trying to use a switch statement with constants but it doesn't appear that the switch statement can see the constants. At the top of the class I have: private final String A_B_C = 'a b c'; ...
Arthlete's user avatar
  • 4,857