Suppose you have a message like this, generated from an email you’ve received…
“User User has requested your approval for the following item: https://ruby-force-1213-dev-ed.cs97.my.salesforce.com/p/process/ProcessInstanceWorkitemWizardStageManager?id=04i0U000000e9je
Please click this link to approve or reject this record.
…and you need to extract that recordId. In the scenario that inspired FindText, the goal was to use Flow to auto-approve the approval request represented by that recordId.
If you’re comfortable with formula functions, you can use them to pull the string out. We wanted to make it a little easier, so we created FindText. This initial version of FindText is quite limited as it will only find a string of a specified length that follows a specified prefix string. So in our example, we’re able to pass in the string along with these specific values:
This action, when passed the above email body, returns ’04i0U000000e9je‘.
The action outputs two values:
- foundString &
foundString will contain the first hit and is useful if you’re only expecting a single hit. foundStringCollection will contain all of the hits.
See this action in action in this Approval Process example.
Searching by length and prefix is only one of hundreds of ways you might want to extract substrings. Feel free to request other modes of query in the comments here.
This action uses Salesforce Apex regex. Ideally, it will become the friendly way for flow creators to tap into the power of regex