+44(0)1908 545 770
YOUR EXPERT RPA PARTNER

Team up with our RPA strategy and tech specialists for maximum automation impact

Find out more
Harness the power of UiPath in your business.
WATCH NOW

Save money and spend more time on priority work.

Book consultation
READY, SET, AUTOMATE

Let's choose, design and deploy a process automation solution for your business.

Find out more
TRANSFORM YOUR BUSINESS

Let's analyse your business to discover opportunities for innovation and automation.

Find out more

Begin your business transformation journey

Book consultation
AUTOMATE EVERY FUNCTION

Automate where it matters most. Scale to solve challenges in every area

Find out more
GIVE EVERY TEAM THE TOOLS FOR SUCCESS

Equip people with user-friendly solutions that save time and make work easier

Find out more

Which business problem
can we solve first?

Book consultation
21 May 2015

Login as another user and check-ins with K2 Smartforms

When you develop an application with K2 smartforms often some of the functionality you expose to the users are role dependent.

The Administration tab for instance should only be viewable by users in the Administration role. To test the functionality you then need to login as the specific user. This is quite simply achieved by executing the runas command from your command prompt:

K2 Automated Testing Software

BenchQA allows full test automation of K2, including fully automated K2 SmartForms and K2 Workflow testing. It promotes test driven development for K2 and ensures continued quality assurance for K2 solutions. Easily apply changes to test cases to accommodate changes to K2 apps and ensure all apps are regression tested to avoid defects and assure continuous quality.

 

Free K2 Five Upgrade Review

runas /user:domainusername “c:Program FilesInternet Exploreriexplore.exe”

Usually while you develop your changes are immediately visible at the runtime URL of your form, after you have saved your changes . But when you login as another user there is a little gotcha that has caught me out multiple times. You need to remember to check-in your changes, otherwise the changes will not reflect.

Another issue that often arises is when you need to force a check-in on a forms and views that an employee who is on leave/sick/has left has checked-out. To do this you will need to execute some queries against the K2 database. You can use the following queries to retrieve the ID’s of the forms/views that has been checked out:

USE K2

–For checked out views

SELECT ID, DisplayName, CheckedOutBy
FROM Form.View_Design
WHERE CheckedOutBy = ‘K2:DenallixUsername’

–For checked out forms

SELECT ID, DisplayName, CheckedOutBy
FROM Form.Form_Design
WHERE CheckedOutBy = ‘K2:DenallixUsername’

Now that you have the ID’s of the views and forms that has been checked out you will need to execute the [Form].[aCheckInContexts] stored procedure in the K2 database. The Pprocedure has two parameters, the first being the UserID (domainusername) and the second being a table variable consisting of two columns. The first column is the ID of the form/view that needs to be checked in and the second is the Type – ‘F’ for forms or ‘V’ for views. The code belowe shows how this can be achieved:

DECLARE @MyTable Form.ContextTableType

INSERT INTO @MyTable([ID], [Type])
VALUES (N’97CD2824-D36D-46A7-97AF-BA0F2DFF06CD’, ‘F’)

EXEC [Form].[aCheckInContexts] @UserID= N’K2:DENALLIXUsername’, @ContextData=@MyTable

Need further technical advice or support?