Views:

Question


Is there a way to add a variable between two other variables? So, we have officehide and cellhide, but if both numbers are there, we want a | to separate. Would it have to be one giant formula or multiples?
 

Solution


1. Go to Fields

2. Create a new Field
Type: Select Formula



3. Copy and Paste the below code snippet (also attached): into the Formula Editor:

string strPhone = "(!Phone!)";
string strMobile = "(!Mobile!)";
string strFax = "(!Fax!)";
List strMulti = new List();

if (strPhone != "")
{
strMulti.Add("Tel: " + strPhone);
}
if (strFax != "")
{
strMulti.Add("Fax: " + strFax);
}
if (strMobile != "")
{ strMulti.Add("Mobile: " + strMobile);
}

return String.Join("| ", strMulti.ToArray());



 
NOTE: The separator, below can be changed to another value e.g., ","



4. Click SAVE

5. Click on SEND TEST EMAIL to test the configuration for different users with different contact numbers:



You can find the code here.
 
 
 
 
 
 
 
 
Related Products: CMS GWS, CMS M365, Designer 6 (for CMS M365)