Power Automate (WDL) function
substring — Power Automate (WDL) function reference
Slice by position and length.
Syntax
wdl
substring(text, startIndex, [length])
Examples
wdl
substring('PowerStack', 5, 5)→ "Stack"
wdl
substring(triggerBody()?['InvoiceNumber'], 0, 3)
→ The first three characters, e.g. "INV"
Omitting length returns the rest of the string from startIndex onward.
wdl
substring(item()?['Email'], indexOf(item()?['Email'], '@'))
→ Everything from the @ sign to the end of the address
Common mistakes & gotchas
- length is optional — leave it out to get everything from startIndex through the end of the string.
- startIndex + length beyond the string's actual length throws "startindex and length parameters do not fall within the range" — check length() first rather than assuming a fixed size.
Related Workflow Definition Language functions
From Strings