Questions tagged [switch]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
17 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
1answer
143 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 ...
1
vote
1answer
31 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(); ...
7
votes
1answer
1k 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'; ...