function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sales_usersales_user 

How to write a CASE Statement?


I am creating a pipe dilimited workflow email based on the values in the delivery Method.
Fields are

Account : XYZ
Delivery Method : picklist values are
                  (a)Mail
                  (b)Phone
                  (c)Fax
                  (d)Email

Address                        : 200 Main Street, Chantally, VA 20102    (Picklist dropdown)
Ship to New Address: Checkbox
Address Line 1           :  50 Roger Drive
City                                :  Houston
State                             :  TX
Zip                                :  34098

If Delivery Method = Mail,  then User can select address from the address field dropdown list.
                     Otherwise, they can select "ship to new address" checkbox which will
                     disable the "address" field dropdown. User have to enter new address in
                     address line1,city,state,zip.
         
Can you please help me to write a case statement.

1. If I select Mail and select address from dropdown vales

 How to split the address string "200 Main Street, Chantally, VA 20102" and place "200 Main street" under "address line1",   "Chantilly" under city etc.
   
  2. If I select Mail and select "Ship to new address"  checkbox. How to handle these two scenarios in my case statement.


You may update the following case statement


CASE( Delivery_Method_vod__c ,
 "Mail",
  {!Lead_Inquiry_vod__c.Name}| {!Lead_Inquiry_vod__c.Address_Line1_vod_c}|{!Lead_Inquiry_vod__c.city_vod_c}|{!Lead_Inquiry_vod__c.zip_vod_c},
 "Phone",
 {!Lead_Inquiry_vod__c.Name}| ,{!Lead_Inquiry_vod__c.Phone}| )

sales_usersales_user

I should get only one row when choosing phone option. But see the output file. What Am I doing wrong?

 

Code

-------

CASE(Lead.Delivery_Method__c ,
"Mail",
FIRST NAME= {!Account.FirstName}|ADDRESS= {!Address.Address_Line_1__c},
"Phone",
FIRST NAME={!Account.FirstName}| TELEPHONE={!Account.Phone}
)

 

 

Output

---------

CASE(Lead.Delivery_Method__c , "Mail",
FIRST NAME= Nancy|ADDRESS= ,
"Phone",
FIRST NAME=Nancy| TELEPHONE=(xxx) xxx-4567
)