Quantcast
Channel: Symantec Connect - Endpoint Management - Articles
Viewing all articles
Browse latest Browse all 706

Determine if Workflow is running in Debug

$
0
0

When creating a workflow which uses Windows Authentication it is impossible to retrieve the current user (Get Current User-component) when debugging the workflow.
Each time you need to debug the workflow you have to disable the Get Current User-component and put a fixed result in there.
I have created an additional component to overcome enabling and disabling the get current user-component when debugging and publishing the application.

This is an overview of a simple workflow. It uses Get Port Number (Code (Script) Component) to retrieve the port number from which the workflow is being accessed. In non-debug situation it is most likely port 80 (HTTP) or 443 (HTTPS). Debug sessions always run at a random port number above 1024.
If it is port number 80 then we go to the Get Current User-component. If it is a different port number then we put a static value (Add Data Element-component)

2016-03-18 16_34_33-mRemoteNG - confCons.xml.png

Here follow the steps to recreate this workflow

Step 1: Locate the Code (Script) Component. This component is included in library LogicBase.Components.Scripting.dll

2016-03-18 16_43_59-mRemoteNG - confCons.xml.png

Step 2: Drag it into your workflow and edit it.

Step 3: Leave the Input Parameters empty and click Next

2016-03-18 16_44_26-mRemoteNG - confCons.xml.png

Step 4: Configure Result variable with type "Number (integer)" and a variable name (eg. iPort)

2016-03-18 16_44_32-mRemoteNG - confCons.xml.png

Step 5: Configure namespaces

System
System.Web

As source code enter

return HttpContext.Current.Request.Url.Port;

2016-03-18 16_44_36-mRemoteNG - confCons.xml.png

Step 6: Just click Finish.
REMARK: Run test will generate an error.

2016-03-18 16_44_40-mRemoteNG - confCons.xml.png

Step 7: Add a compare number component. And Compare the result with port 80 (HTTP)

2016-03-18 16_52_49-mRemoteNG - confCons.xml.png

Step 8: Add Get Current User component after path equal to

2016-03-18 16_44_48-mRemoteNG - confCons.xml.png

Step 9: Add new data element component after paths less than and greater than

2016-03-18 16_44_56-mRemoteNG - confCons.xml.png

Step 10: When running the workflow the current user will result in value DEBUG.
Running it in production it will give the actual user name.


Viewing all articles
Browse latest Browse all 706

Trending Articles