How to determine Process initiated by UiPath Studio, Assistant (Agent) or Orchestrator?

Hi guys,

I’m developing a process for producing reports and send to my stakeholders through email.

I would like the process to send email to me only during development and when deployed in production should send email to stake holders.

Note: I’m able to do this manually by enabling and disabling Assets but I would like to automate this part.

Thank you in advance.

*** UPDATES ***

I found a quicker way to do this, is by checking if Debug folder exist in the process folder.

See screenshot.

Here is the logic

1. Get Current Directory and Assign Debug folder path (\.settings\Debug)
2. Check if directory exist 
   (If True then NonProduction Else Production)

See the screenshot.

Let us know if this thread helped to solve your requirement: How to determine whether a process was run from an Orchestrator

You can check using a Rest API endpoint as below:

GET for https://cloud.uipath.com/ORGANIZATION_NAME/TENANT_NAME/orchestrator_/odata/Jobs and you may check the Source and SourceType values

SourceType possible values: 

  Manual -> 0
  Schedule -> 1
  Agent -> 2
  Queue -> 3
  StudioWeb -> 4
  IntegrationTrigger -> 5
  StudioDesktop -> 6
  AutomationOpsPipelines -> 7
1 Like

Hello @wilbardmtei ,

Assuming your use case is for Attended, You may try using assets and configure Asset Per Robot to achieve this function. The robot will pick the email ID based on the machine the process is running.

Regards,
Balram

Thanks Marian, I have tried that but for some reasons when running a process from UiPath studio it does not show on the list of jobs. So I have used you idea and used these JSON items to filter

State => Running
ReleaseName => Get Project Name from Reading project.json
HostMachineName => Environment.MachineName
RuntimeType => Development

if results is null or is not null but runtimetype is Development then is running from Studio/Studio Assistant

1 Like

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