ABBYY FlexiCapture - Rules and Custom Actions

Learn how to create rules and custom actions within ABBYY FlexiCapture. Rules are triggered when data changes, and custom actions are triggered when a user clicks a button.

Hello. Today, I'm going to show you how to create rules and custom actions within the ABBYY FlexiCapture.

Now, what you see in front of you is a ABBYY Flex form. This is just a very basic document definition. Sometimes we call it a template, but that's not really the point today. The point today is how we create the rules and custom actions. We have other videos that show you how to create this form, and, in fact, even the project that goes around this form. You can find that on our website if you'd like more details on that, but today, let's focus on those rules and custom actions.

What we're going to do is create a new field. What this field is going to do is going to merge first name and last name. We'll call it something like full name. It's going to put first name, space, last name. That is what we consider a rule. Now, the difference between a rule and a custom action is that rules happen on the fly, as data changes. A custom action actually requires user input, and you'll see that here, the button that we create here in just a second.

But the very first thing we're going to do is create a new field, and we'll give this field a name first, and we'll call it something like Full Name. Then we will add a rule. The rule that we are going to use is a merged field, because we want to merge first name and last name, but you can see there are other types of neat rules here, including calculations or comparing fields, but, in fact, you can write even your own script. But, once again, remember that these rules happen on the fly as data changes, so you do want to be a little bit conservative on when you implement your own custom logic versus what you can do out of the box within FlexiCapture, but a lot of cool options here.

For today, we're going to merge these fields, and we'll just call this our merged fields rules, and we'll actually give it a proper name, Merge First and Last Names. You can see here just some of the out of the box options, if we want to show this as a message to the verifier, when we want to apply this rule. We can set certain conditions so that a certain field is not empty, and those kind of things. But for today, we're just going to leave this as the default.

Then you can see we have tags here. Tags are just used as shortcuts for finding it in the future. If we have a lot of rules, it's important that we tag, so we can find them easily. Then, of course, we want to make sure that this rule is enabled, so we'll click Next.

We're going to add fields that we want to merge. Now, this is obvious, because we know that we have first name and last name. Select first name, select last name, and you see there it populates it in our Fields to merge list box. It's going to ask you the resulting field, which is going to be this, which is where we're at here. We're going to put, what do you want to separate those? I'm simply going to type a space. Then, of course, we have the option here to put separators for empty field values, which we're not going to select for this, and we can simply hit Okay, and we're done there.

You can see here that the rule is applied. We have our Full Name option here. Now if we go and we run a test, and we just start populating data here, you'll see that it does our merging fields here. We can even put first and last, and watch how the Full Name field gets modified as that happens. I'll do it one more time. I'll do John and Doe, and see how the Full Name field here merges those two with a space deliminating the two words. So, a neat little option there. That is a rule. Once again, you can see it as I type, it modifies the merged field option here.

Now, the next thing I'm going to show you is how to create a custom action. Now, custom actions require a user input to trigger that action, and what we're going to do is create a new field, and we're going to call it Approver. You can see here that the Approver name then happens right here.

I'm going to modify the field after we added it, and we're going to create a custom action. You can see the custom action is right beside the rules, so we're going to enable it, and these are the available fields. Sometimes there is logic from the form that we want to use within the custom action, so for example, we may want to use Full Name. We can see that when we have them marked as read only, it means that we only have access to that field, but we cannot modify the field, which is a little bit different here. We actually want to be able to control the Approver name, so we're going to actually make sure that that's read only for us.

But, for Full Name, we just want access to that field, so we don't really need it to be writeable for us, so we're just going to leave that as read only, and then you see here, we can go into the scripting. The scripting within ABBYY FlexiCapture is very, very powerful. It's very neat, and I would recommend that you use some free time of yours to investigate it and learn it, but all I'm going to do is simply write a very basic script. I'm just going to copy and paste it here, and I'll walk you through it.

What we're going to do is we're going to show a message box, and then we're going to say, "Do you want to approve this time sheet?" It's going to prompt them with a Yes or No, and if they hit Yes, equals Yes here, then we are going to modify this text box with the user name that is currently using FlexiCapture, and a date and time. It's that simple.

Notice how in the other window before us, we put what other fields we want to have access to, and the reason we may want that is because we may want to pass those fields to our logic. For example, we may want to create a variable here called Full Name, and what we're going to do is ... Oops, excuse me. You can see here we may want to access that field. We may use this now within our message box here to say something like, "Do you want to approve the time sheet for ..." Use that. Something like that, so what it's going to do is simply use the Full Name within a variable, but then we can use that variable in our logic here.

I'm going to take this away just for one second. Notice that we only have access to two fields, even though there are multiple fields on this document definition, but these are the ones we told the rule that it has access to. This one, of course, you remember is read only, where the Approver is not. The Approver name is something that we have full access to control.

Once again, we're just going to prompt the user, "Do you want to approve the time sheet for ..." whatever the Full Name is, and then we'll get a Yes or No, and then if they hit Yes, we'll populate the field. So, it's very, very simple.

Now, what I recommend doing every time you write a script is that you hit the check button, and you'll see here that it is not complaining about our code, it likes it. It says the "Script is correct." If there is a problem, however, you'll have to make sure you resolve that problem before moving forward. We're going to hit Okay, we're going to save, and then we can close this.

Once again, having the Approver name not read only is very important, because we actually want to populate that field. If it's read only, we don't have the ability to populate the field. Let's hit Apply, let's hit Okay, and let's watch these two rules and custom actions run together here as we do a test.

Let's populate a first name. We'll say John Doe. Remember the Approver name is the one that's going to prompt us with a message box. Now, notice this little box over here that has the three dots here. That is our custom action, so if we have a custom action that we want to perform, we click that box, and you'll remember, this is the message box that we wrote. It says, "Do you want to approve the time sheet for John Doe?" Of course, if I hit No, it's not going to do anything, but if I hit Yes, it's going to populate this field with the current user's name plus a time stamp that tells us when that was approved.

So, that is the idea of rules versus custom actions. Both have their place throughout the business process within FlexiCapture, but I wanted to show this to you today to show you how advanced the tool is, and how easy it really is for us to apply our own logic right out of the box.

I hope you enjoy this video. If you have any questions on rules or custom actions, feel free to contact us, and we'd love to be of service to you. Have a great day. Thank you.



Information about the Author
Travis Spangler
About Me
Articles by Travis Spangler: Travis writes articles dealing with various technical aspects of document capture and forms processing. He is fluent in Microsoft.NET and holds several certifications including ABBYY FlexiCapture and IRISXTract. As general manager and sales director, he controls the daily operations as well as manages customer accounts to ensure both customers and prospects are receiving the very best from UFC, Inc.
Some of My Other Articles