I am working to enhance my skills Microsoft Flows and am starting to use Workflow Definition Language (WDL) expressions.
I have created a flow sets up a variable containing the first names of the father or mother or both. The first names are extracted from Microsaft form response fields containing combined first and last names. It is possible that these fields could be empty, have one parent, or have both.
I created a variable called FirstNameString that I would like to use in a salutation in a customized email further down in the flow. Unfortunately, I am getting a "Definition contains invalid parameters", when I try to save the flow after inserting the variable.
The expression is:
if(and(empty(variables('FatherFirstLast')),empty(variables('MotherFirstLast'))),'',if(and(not(empty(variables('FatherFirstLast'))),empty(variables('MotherFirstLast'))),substring(variables('FatherFirstLast'),0,indexOf(variables('FatherFirstLast'),' ')),if(and(empty(variables('FatherFirstLast')),not(empty(variables('MotherFirstLast')))),substring(variables('MotherFirstLast'),0,indexOf(variables('MotherFirstLast'),' ')),concat(substring(variables('FatherFirstLast'),0,indexOf(variables('FatherFirstLast'),' ')),' and ',substring(variables('MotherFirstLast'),0,indexOf(variables('MotherFirstLast'),' '))))))
I should point out that the logic identifies the index of the space between the first and last name, which is then used as the length in the substring for the first name.
Appreciate help from anyone.