Hi,
Today I'd like to expand the topic first covered in this blog post. There I was explaining in details how you can create Help Desk applications by integrating your SharePoint's lists with emails. You saw how easy it is not only to receive new service requests via email, but also how to configure email-based approval processes.
One of the most useful functions we briefly covered there was $Extract. As with all the other functions, you can find it in the Value Picker and use in conditions and updates. As its names implies,$Extract function allows you to extract parts of a longer text according to patterns that you define. For instance, when you want to email an update a service request, implemented as a SharePoint list item, you would want to pass the unique identifier to the system, specifying which service request you want to update (the item ID is the usual candidate for this identifier). For example, in our internal CRM system, we pass the ticket ID in the subject line of every outgoing email: "some subject IWID:100", where the ID is 100. This way, when the customers reply and we import that reply, the system knows which ticket it needs to update.
$Extract function accepts 2 parameters:
- Value - can be text, column name, another function or a combination of them. This is the incoming value you want to extract from.
- Pattern - instructs the system how to extract the value. Generally in the format Prefix^Suffix, where ^ is the value you want.
For example $Extract([Subject]|?IWID:^) will extract the ID number from "some subject IWID:100". You might notice that we preceeded the prefix with a question mark. It means that we a looking for it at any position within the text. Without the question mark, it would expect the text to start with IWID:. Also, we omitted the suffix, which means we are going to get everything up to the next space, line break or comma. If you want to terminate at the line break only, include \r as the suffix.
In our internal CRM system we use $Extract functions for any purposes:
- Updating the correct ticket the additional details coming from subsequent email. We use $Extract to get the ticket ID from the subject line. $Extract([Subject]|?IWID:^)
- Categorizing tickets. By including IW:Sales or IW:Support tags in the body of the email and CC'ing our CRM system, we instruct it to properly tag the new tcket. $Extract([Body]|?IW:^)
- Closing tickets. By including IWID:Close tag anywhere within our reply, we instruct the system to mark the ticket as closed.
You might notice that the Value Picker and, as the result, $Extract function are available not only in email. In fact, currently 8 products make use of this module:
- Smart List Pro - used in conditions for permission and validation rules.
- Smart Action Pro - used in conditions for actions, Create/Update actions for setting values and as parameters for various action types.
- Smart Import Pro - used in conditions and in Create/Update/Sync actions for setting values.
- Smart Print Pro - used in conditions for selecting default print templates.
- Smart ID Pro - used in conditions for selecting ID template.
- Smart Alert Pro - used in conditions for alerts.
- Associated Tasks Field - used in Associated Items Summary field in conditions.
- Color Field - used in Indicator column for specifying values.
You can see now how powerful this single function can be. It's a great tool for making your business systems even more intelligent.