I have two string variables with email or phone information - converted form regex. (FYI If the field is blank I am getting a “” (nothing) result - as expected). I am having trouble with two scenarios, please see below.
My Variables names:
VarEmailString
VarPhoneString
My scenario: I need to complete two fields differently when the variables are blank. I will be using the If activity to complete the follow up actions. Photos are attached with my attempted solutions.
Problem #1 / Field 1:
If VarPhoneString or VarEmailString is not blank then click Reply to Customer.
Else if both are blank then click FYI only.
Problem #2 / Field 2:
If VarEmailString is blank - then go to nested If statement that says: If VarPhoneString is blank - then select return via email.
Else - if both are blank then select N/A.
It’s probably a simple solution but I am having some trouble, so any assistance with a VB expression solution would be appreciated
when you are using regex the output is list of matches, so first you must go through that list and check if you pattern is ok,put some condition for validation in loop and if that condition returs true assign that item to variable. After that loop you can use if statement and in contdition you can write String.IsNullorEmpty(VarEmailString) as @Michael_Udhaya wrote to control your flow.
The ‘IsNullorEmpty’ string options did not work for me in this instance.
I did discover that ‘IsNullorWhitespace’ was the solution.
Problem 1’s solution:
Put the below expression in the VB expression of the If activity (see below images):
“string.IsNullOrWhiteSpace(VarEmailString) and string.IsNullOrWhiteSpace(VarPhoneString)”
Simply put - If both phone and email variables are blank/whitespace THEN click ‘fyi’ ELSE Click ‘reply direct’
Problem 2’s solution:
I solved this in two steps.
Determine if Phone variables and Email variables are blank
IF both email and phone variables are blank THEN type n/a (like problem 1) ELSE see step 2
Determine whether to type in Phone variable or Email variable
Insert another If activity and check if phone variable is blank using same VB expression in step 1(string.IsNullOrWhiteSpace(VarPhoneString) THEN type Email option ELSE type in Phone option (fyi only - phone is business preference)