1

we are currently in the process of developing a custom preference centre via cloud pages. In one of the tabs we ask users for region/travel preferences. We have 6 checkboxes corresponding to 6 regions.

We will restrict the submissions to 3 options via the UX. We are saving these values both in Marketing Cloud via a boolean field for the selected regions and in Salesforce Cloud via 3 text area fields.

What's the best way to write the if/else clauses to consider this scenario (get the 3 values of 6) without getting tangled in the ifs? I was thinking if there is a way of ''grouping'' these values in batches of 2?

I have decided to apply a corresponding ''text label'' to the selected boolean value of True which I will then use when I update the Salesforce object where we store these preferences:

 IF (@PlacesEurope == 'True') THEN 
    SET @RegionUnu='Europe & Britain'
    ELSE 
 ENDIF

  IF (@PlacesSouthAmerica == 'True') THEN 
    SET @RegionDoi='South America'
    ELSE 
 ENDIF

   IF (@PlacesNorthCentralAmerica == 'True') THEN 
    SET @RegionTrei='North & Central America'
    ELSE 
   ENDIF

   IF (@PlacesAfricaMiddleEast == 'True') THEN 
    SET @RegionPatru='Africa & The middle East'
    ELSE 
   ENDIF

    IF (@PlacesAUSNZ == 'True') THEN 
    SET @RegionCinci='Australia & New Zeeland'
    ELSE 
   ENDIF

    IF (@PlacesAsia == 'True') THEN 
    SET @RegionSase='Asia'
    ELSE 
   ENDIF

I have attached a snippet of the UX.

Any guidance is much appreciated!

Giulietta enter image description here

  • 1
    I think this post is rather hard to read. But i am not a native speaker. Could you maybe rephrase your aim that it becomes clearer? – Johannes Schapdick Oct 22 at 14:25
0

You can either use nested if statements or use elseif in your if statements. For example,

IF (@PlacesEurope == 'True') THEN 
    SET @RegionUnu='Europe & Britain'


ELSEIF (@PlacesSouthAmerica == 'True') THEN 
    SET @RegionDoi='South America'
    ELSE 
 ENDIF

   IF (@PlacesNorthCentralAmerica == 'True') THEN 
    SET @RegionTrei='North & Central America'


   ELSEIF (@PlacesAfricaMiddleEast == 'True') THEN 
    SET @RegionPatru='Africa & The middle East'
    ELSE 
   ENDIF

    IF (@PlacesAUSNZ == 'True') THEN 
    SET @RegionCinci='Australia & New Zeeland'


    ELSEIF (@PlacesAsia == 'True') THEN 
    SET @RegionSase='Asia'
    ELSE 
   ENDIF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.