Robotic Process Automation (RPA) and K2

I have talked to a few customers who have RPA platforms and it is a very common scenario where they want to compare K2 with RPA to see which provides the best features.

The short answer to this is that you are not comparing apples to apples and comparing these two products isn’t meaningful.

RPA focuses on handling repetitive and mundane tasks.  They are excellent in dealing with applications that don’t offer any form of API integration.  e.g. via web services, SDKs, etc.  Things like screen scraping console outputs and inputting or reading cell data from Excel are just some examples.  They also have the ability to scale out tasks by installing and using robot agents on different machines.

K2 is a strong platform for user tasks allocation and worklist management.  Easy to build forms with workflow integration allows for rapid low code application development.  K2 gives the ability to track and manage your workflows.  The data integration tier allows you to easily expose pre-defined data through our data layer (SmartObjects) using OData.  This allows you to integrate with tools like PowerPI or Excel for strong insight into your business.

With these two categories of products, there isn’t a need to choose one or the other as they are focused on providing different functionalities to your enterprise organization.

Combining both of them provides powerful capabilities in addressing complex business needs which earlier could not be addressed by either product alone.

If you interested in finding out how this works, K2 has a new KB article which covers this (with Blue Prism).

Advertisements

Monitoring SmartActions

As you know, SmartActions is a pretty powerful mechanism to allow for quick approval via email.  This makes it very convenient for mobile users to approve tasks just by replying to task emails.

The early implementation of SmartActions used the Sync State and Exchange Web Services (EWS).  The K2 server would synchronize via EWS to check for new emails to process. When the number of emails was large, there was a strong chance that the sync would fail at times.  This cause a lot of issues for heavy users of SmartActions.  There was also a strong need to regular maintain and clear the inbox of the SmartAction account.

In 4.7, this mechanism was changed to stop using Sync State.  Basically, SmartAction now moves a processed email into the deleted folder when done.  Note that there is also a coldfix for 4.6.11 which provides the updated functionality (you can request from K2 support if you need it, please quote TFS#660588).  This made SmartActions perform a lot better and this also made maintenance easier.

However, a customer encountered a rare occurrences where a specific email caused SmartActions to stop processing.  Removing the offending email (the earliest dated email in the Inbox) usually would fix this.

As we can’t really predict if a scenario like this happens, I have done up a powershell script to allow us to detect when the SmartAction mailbox builds up.  This is based off the same technique used in this article Using powershell and task scheduler to notify for K2 errors.

The setup in task scheduler is exactly the same as the above article.  An additional step is required after step 8.  Configure the option “Run whether user is logged on or not”.  For the credentials, specify an account that has Exchange Admin rights to query mailboxes.

smartactionalert1smartactionalert2

The only other difference is the PowerShell script being executed.

Write-Host “Checking SmartActions Mailbox”
$Threshold = 5 # Adjust the threshold according to your environment
$Mailbox = “K2Service” #Smart Action mailbox ID

Set-ExecutionPolicy unrestricted
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://DLX/PowerShell/ -Authentication Kerberos
Import-PSSession $session -CommandName “Get-MailboxFolderStatistics” -AllowClobber
$MailCount = (Get-MailboxFolderStatistics -identity $Mailbox -FolderScope “Inbox”).ItemsInFolder # Microsoft returns both hidden and visible items currently. No mechanism to filter.
if($MailCount -gt $Threshold)
{
$emailFrom = “system@denallix.com
$emailTo = “administrator@denallix.com” # person to notify
$smtpServer = “mail.denallix.com
$subject = “SmartAction Mailbox Count”
$body = “{0} Mails Found in mailbox {1}`n`n” -f $MailCount, $Mailbox
Write-Host $body
Send-MailMessage -To $emailTo -From $emailFrom -Subject $subject -Body $body -SmtpServer $smtpServer
Write-Host “Send notification email”
}
Write-Host “Check SmartActions Mailbox complete”

So a couple of things to note for the script.

  • Change the items in red to the values in your own environment
  • The ConnectionUri value should use server name and not the Exchange alias.  Using the alias will usually throw a WinRM error.
  • The notification portion uses SMTP.  So you will need this to be configured on your mail server.
  • The Get-MailboxFolderStatistics has an issue where it returns the count of both visible and hidden emails.  So you might notice that the email count might not be the same as what you see in OWA.  Unfortunately, Microsoft doesn’t have a way to filter away the hidden item count.  So you might want to tweak the $Threshold value to a value that makes sense for your environment and application load. Note that the default SmartAction polling interval is 30 seconds.

 

Customizing a SmartForm Page Title and Icon

If you have created a SmartForm page, you normally notice that the browser tab shows the name of the form and it uses the standard browser icon.

SetTitleIcon1

Test SmartForm called “DemoPage1”

 

To do your own custom title and icon, we can make use of a short snippet of javascript to fix this.

The first step is to edit your form and add a data label control to it.  Mark it as literal.

SetTitleIcon2

Now add a transfer data rule on the form initializing event.

SetTitleIcon3

Configure the transfer data rule to include this simple snippet of code.  Change the values in red to your desired title and icon file.  In this example, I am changing my page title to “Account Summary” and I am using the stackoverflow site icon for demo purposes.

document.title = “Account Summary“;var link = document.createElement(‘link’);link.rel = ‘apple-touch-icon’;link.href = ‘http://www.stackoverflow.com/favicon.ico‘;document.getElementsByTagName(‘head’)[0].appendChild(link);

Note: WordPress strips out script tags from the text above.  Add the script tags to make it look like this.

SetTitleIconscript

You should now have a rule like this configured.

SetTitleIcon4

Now save up your form and check it in.

Once we run the form to test, we now should see that the title and icon is now showing what we configured.

SetTitleIcon5a

If you access the form from your iOS device using Safari, you can save the form shortcut to the home screen by using the “Add to Home Screen” option.

SetTitleIcon6a

You will see that you have your own customized icon.  Nice!

SetTitleIcon7a

Monitoring K2 SmartForms with eG Innovations

Introduction

I often come across poor performing SmartForm applications and have had many successes tuning and optimizing them.  However, this is somewhat reactive.  Business users will normally complain first before developers take action.

Recently, I was invited to take a look at one of the application performance monitoring tools called eG Enterprise.  This is a product by the company eG Innovations which is headquartered out of Singapore and has offices globally.  They have both on-premise and cloud based monitoring solutions and one of the interesting capabilities was the ability to monitor across different layers in the application (network, IIS, SQL, storage, etc).

In this article, I will be covering:

  1. How to install and configure eG Enterprise to work with a K2 setup.  This will be using their cloud based version.
  2. Show off some of the monitoring and dash board functions available in eG Enterprise.

Installing eG Agent

1. Before doing the setup, we added a configuration on the eG site to allow us to test the agent.  In this case, we added a SQL component which points to our server.  Note that I was testing this on a internal virtual machine via NAT so I configured an internal IP address.  In a production scenario, you can open the SQL server’s port to the eG’s external agent IP.  This will allow it to monitor the SQL server service.

eG1-2

2. On the K2 server, run the correct setup file for your OS platform.  In my case, this is on Windows 2012 R2 x64.

eG1-1

3. Click Next on the welcome message screen.

eG1-3

4. Click Next on the License Agreement page.

eG1-4

5. The default setup location is C:\.  In my case, I choose to put it in C:\Program Files\.

eG1-5

6. Choose whether your setup is using SSL or not. In this setup, we are using SSL so click Yes.

eG1-6

7. You can choose whether to only allow trusted certificates.  For this setup, I selected No.

eG1-7

8. Specify your eG Manager site name and the port.

eG1-8

9. No proxy is involved on my setup so I selected No.

eG1-9

10. Click Next on the summary page.

eG1-10

11. Click Yes to assign a name for the eG Agent.

eG1-11

12. Give a nickname to this host (This will be used later in the configuration).

eG1-12

13. That completes the setup!

eG1-13

14.At this point, you will see two windows services installed (eGAgentMon and eGurkhaAgent).

eG1-14

15. You can check the agent error logs to see if there is any communication errors between the agent and the eG manager.  The log file can be found in <install dir>\eGurkha\agent\logs.

eG1-15

Configure eG Manager

For the eG configuration, I will be covering the key configuration screens that were used for this demonstration.  Note that it is recommended to work with the eG team to make sure your environment is configured to the way you want and that the right components are monitored.

16. After the agent setup, we can then configure the IIS component.  This will be for the web layer monitoring.  The host nick name specified earlier will be used.

eG2-1

17.  The Real User Monitor (RUM) component will be the required for us to track the real time usage of the application.

eG2-2

18. Once this is done, we can create a segment and include the different components.  This is one of the cool features available on the eG platform to allow monitoring to the different tiers in the application.

eG2-3

19. The other item that you would want to tweak is how eG monitors the application.  This involves the “URL Segments to be used as grouped URL” setting.  By default, it groups applications by the first and second URL segments.

eG3-1

20. As the SmartForms URL path is usually in the format <base url>/Runtime/Runtime/Form/<Form Name> or <base url>/Runtime/Runtime/View/<View Name>.  The first and second segments represent “Runtime/Runtime”.  We will switch it from “1,2” to “3,4” to differentiate each SmartForm Form and View.

eG3-2

Configure IIS URL Rewrite Rules for Real User Monitoring

Now to be able to use the RUM component, eG has two ways of integrating with your application.  The first method involves script injection into your master page (assuming this is an ASP.NET solution).  For SmartForms, we will be using the second method which is to use the IIS URL Rewrite method.

21. Important! To use the IIS URL Rewrite method.  First download and install IIS URL Rewrite 2.0.  Version 1.0 is installed on Windows 2012 R2 and needs to be upgraded.

22. As outbound URL rewriting can only be done on uncompressed context, we need to turn off static compression.  In IIS Manager, click on the Compression icon under the Runtime folder.

eG4-1

23. Uncheck the Enable static content compression checkbox and save your settings.

Note that K2 by default turns this setting on for performance reasons.  Turning static compression off is required in this case.  This might cause a performance hit due to higher bandwidth traffic depending on the content of the page.

eG4-2

24. Outbound rewriting can be used together with IIS dynamic compression if you set the following key in the registry.

 

eG4-3

Note: You can also add it using this command.

reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled /t REG_DWORD /d 0

25. Now let’s configure the RUM Head rule which inserts the start time script.  Under the Runtime folder, click on the URL Rewrite icon.

eG4-4

26.Click Add Rule(s)..

eG4-5

27. Select Outbound rules > Blank rule.

eG4-6

28. Give a name “eG RUM Head Rule” and select <Create New Precondition…>.

eG4-7

29. Give a name “isHtmlContent” and click Add.

eG4-8

30. Enter a pattern of “^text/html”.  Your Add Condition dialog should look like this.  Click OK.

eG4-9

31. Click OK to save the Precondition.

eG4-10

32. On the Edit Outbound Rule screen under the Match section, enter the Pattern value of “</head[^>]*>”.  Under the Action section, enter the Value of

eGscript1

eG4-11

33. Click Apply to save the settings.

eG4-12

34. Now we will be adding the RUM body rule.  Repeat steps 25-27.  In the new Outbound Rule.  Give the name “eG RUM Body Rule” and select the isHtmlContent precondition.  Under the Match section, enter the Pattern value of “</body[^>]*>”.

eG4-13

35. For the Action section, enter the value

eGscript2

eG4-14

Note: The settings in red will be taken from your configuration in the eG manager.  This will be unique for your side.

Note: If your SmartForm runtime site is using SSL, the settings need to also match accordingly.  i.e. the RUM URLs must also be using SSL.

36. To verify that you have done this right, you can run any SmartForm page and view the page source.  You should see these two script sections being inserted.

eG4-16eG4-17

eG Monitoring

Now here is the good stuff!  If you have done everything right, you will get access to the various dash boards and reports.

Layer Monitoring

You can see the health of the various layers and also be able to pinpoint issues at each tier.  In the screenshot below, we can see that there are some errors found in the system event log.  You can access the details directly.

eG5-1

Real User Monitoring Dashboard

This gives real time statistics on your SmartForm site.  You can configure the data collection intervals as required (in this example, we configured to collect every 2 minutes).  You can see where your traffic is coming from and also the various statistics on your pages.

eG5-2

You can also monitor the traffic load and user experience over time.  Very cool.

eG5-3

Page Groups Performance Report

This report allows you to query data over a specified period and it gives you detailed information on how your SmartForm applications are running.

eG5-4

Page Requests – Page Groups Report

This report shows you the average load times of the various pages and is useful for identifying which pages are having performance issues.  This allows your developer to focus on optimizing the right pages.

eG5-5

Top N by Page Views Report

This is another useful report which shows you the number of page accesses over a specified period of time.  This is great for identifying your popular applications and also the profile of your users (browser types and location).

eG5-6

Conclusion

This article is intended to give good insight on how K2 integrates with Enterprise Application Monitoring tools like eG Enterprise.   The capability to have a 360 degree view of your environment and applications can be invaluable and a strong positive impact to the way you work.  I hope this will be valuable to you.  Cheers!

 

 

Password Textboxes in SmartForms

Currently in SmartForms (at the point of writing, we are at 4.6.11), the text box control does not have a password mask option.  I have seen some people resort to building a custom control for this.

However, I wanted to show that it is a simple matter of using a single line of javascript to turn this on.

So a quick way to change your text box control to a password text box.

  1. First drag a text box control to your view and place it where you want.  Give the text box a name that you can identify with.  In this case, I am giving it the Name “txtPassword”.Password1
  2. Now if you run your view, this would be just a plain vanilla text box.Password2
  3. Now add a data label control to your page.  Check the Literal checkbox and put in this line into the Text value “$(‘input[name=”txtPassword”]’).get(0).type = ‘password’;”.Password3
  4. Now run the view and you will know see that the text box now has masking characters in the watermark.Password4
  5. And now you have a password text box!Password5

So as you can see, adding a password text box isn’t that difficult and doesn’t require anything custom to be implemented.  I hope this comes in handy when you wish to do a custom login application using SmartForms.