Questions tagged [switch]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
47 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 ...
1 vote
2 answers
115 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 ...
0 votes
1 answer
706 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 ...
0 votes
1 answer
1k 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 ...
  • 3
1 vote
1 answer
37 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(); ...
  • 132k
9 votes
1 answer
4k 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'; ...
  • 4,581