How to know if I'm running Debug or Run mode


I would like to have a different logic for the process when it’s started from Studio from Debug and Run mode. There was already a similar question but solution was to use a Studio UI which I would like to avoid.

pseudo code

If Job.Mode = "Debug"
  Do this
  Do something else
1 Like

Hey @VRish

You mean you want to write a conditional code to pass different values.


Hello @VRish

Are you trying to execute the workflow in Run mode or Debug mode using any code?
Is that the requirement?

Hello @Nithinkrishna.
Yes, I would like different actions to be executed based on the condition that depends if it is Run or Debug mode

Hello @Rahul_Unnikrishnan.

Requirement is to execute different actions based on the condition that depends if it is Run or Debug mode

Very strange requirement in my opinion, but either way, details of that are held on the RobotRunner in the executor. You cannot expose any values from them without using a custom activity. I’d suggest rethinking your approach, perhaps you can explain why you think you need to do this / your use case?


Have a view on this threads, what you can do with this both options!


Hey @VRish

I’m a little aware that these things are available in other technologies.

Let me think on it. If something comes up will surely post it.


Hey @VRish

This is something which may help us -


Hello @Jon_Smith. Thanks for pointing to RobotRunner. I will explore that.

Use case:
I am working on an attended process. On one of the steps it should prompt user a Form to enter some information.
I don’t need to display a Form to the developer while Debugging and default values can be used. But I would like to have a Form in Run mode.

@Nithinkrishna how exactly it may help us?

These links doesn’t have anything on how to know if job is running in Debug or Run mode

I wouldn’t bother exploring it, like I said, its running on the executor and cannot be exposed natively in UiPath. You need a custom activity in .Net to get close to it.

I think your use case indicates you do not need to detect the ‘mode’.

I would suggest, instead, use a mock, you can easily then mock the activity which will prompt the user and bypass it with default values.

Can you try the same once in Invoke Code with language as C# and trying in both debug and run mode.


@Jon_Smith Could you please elaborate more on the ‘mocking’. I can’t fully understand how it may help here. I need one or another set of data (or set of actions) to be used based on the Mode

Sure, so take the following example workflow.

You want to skip the display form action and instead populate the values with defaults.

So, you mock the workflow and surround the ‘Display Form to User’ activity with a mock, on the right hand side you can add the activities to provide any default values.
Your original workflow stays intact and clean and the mock will be automatically kept in sync when any changes are made.
When the dev wants to test they can run the mock and it will avoid displaying the form as per the mock activity displayed.

didn’t know we have that functionality :smirk: it looks good. will need to play with it. thank you @Jon_Smith

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.