Designers > K2 Designer for Visual Studio > Design Tools > Toolbox > Event Wizards > Server Events > Run As > Run As Verification | Send feedback |
Verifying that Run As is working as expected and is retrieving the specified credentials correctly can be done easily be creating a simple process with one server event and a few lines of code. All the example will illustrate is the following for a design time scenario:
To create a simple process with a server event, do the following:
![]() |
Launch K2 designer for Visual Studio |
![]() |
Start a new K2 project, with the name K2 Run As Test |
![]() |
Add one server event to the design canvas, and connect the Start Activity to the Server Activity using a line rule |
Expected Result: |
Expected Result ![]() |
Change the server event credentials
![]() |
Locate the Service Account Event Template |
![]() |
Run the template and amend the credentials by clicking on the Change button Existing K2 Server Service Account Credentials ![]() |
![]() |
Specified Credentials, which is also a service account but not the K2 Server Service Account: New, specified credentials |
Add the server event code
The following lines of code must be added to the two server events. The code will perform the simple task of extracting the credentials used to run the Server Event.
Server Code Example |
Copy Code
|
---|---|
Console.WriteLine("-------------------------------------------"); Console.WriteLine(WindowsIdentity.GetCurrent().Name); Console.WriteLine("-------------------------------------------"); |
Shown in the images below, are the results from running a published version of the process in console mode. To achieve a similar result, the Developer would need to do the following: