Skip to main content
Solved

How does one determine how a workflow was called at runtime?


christopherlecky
Byte
Forum|alt.badge.img+17

I have a workflow that can be run by hand or called by another workflow.

I need to be able to determine how the workflow was called.

 

Does anyone know how to determine this?

Thanks.

Best answer by Chris Sunderland

Inside the workflow, you can add a script activity which makes a check like such

workflow.getWorkflowId() == workflow.getRoot().getWorkflowId();

This check would return True if the workflow was called directly and false if it was executed inside a parent workflow.


 

View original
Did this answer your question?

7 replies

Mike Struening
Vaulter
Forum|alt.badge.img+23

That’s a good question….so essentially you want to know if the Workflow was run manually, or as part of another Workflow and how to determine which?

I’ll inquire within.  I’m sure the Workflow logs will mention if it was interactive or not, though I’m not sure if that’s enough for you.


Forum|alt.badge.img+6

Inside the workflow, you can add a script activity which makes a check like such

workflow.getWorkflowId() == workflow.getRoot().getWorkflowId();

This check would return True if the workflow was called directly and false if it was executed inside a parent workflow.


 


christopherlecky
Byte
Forum|alt.badge.img+17
Mike Struening wrote:

That’s a good question….so essentially you want to know if the Workflow was run manually, or as part of another Workflow and how to determine which?

I’ll inquire within.  I’m sure the Workflow logs will mention if it was interactive or not, though I’m not sure if that’s enough for you.

That is exactly what I am looking for. I am writing my workflows so they can either be called by external rest calls or ran internally via other workflows, which means the way workflow functions changes based on how it was run.


christopherlecky
Byte
Forum|alt.badge.img+17
Chris Sunderland wrote:

Inside the workflow, you can add a script activity which makes a check like such

workflow.getWorkflowId() == workflow.getRoot().getWorkflowId();

This check would return True if the workflow was called directly and false if it was executed inside a parent workflow.


 

This is awesome, but it does beg a few questions.

Is there a way to interrogate methods?


christopherlecky
Byte
Forum|alt.badge.img+17
Chris Sunderland wrote:

Inside the workflow, you can add a script activity which makes a check like such

workflow.getWorkflowId() == workflow.getRoot().getWorkflowId();

This check would return True if the workflow was called directly and false if it was executed inside a parent workflow.


 

I’ll try this.


Mike Struening
Vaulter
Forum|alt.badge.img+23

@christopherlecky let us know if this gives you what you need!


christopherlecky
Byte
Forum|alt.badge.img+17
Chris Sunderland wrote:

Inside the workflow, you can add a script activity which makes a check like such

workflow.getWorkflowId() == workflow.getRoot().getWorkflowId();

This check would return True if the workflow was called directly and false if it was executed inside a parent workflow.


 

Just figured I would circle back to tell you this worked like a charm.

 

Thank you.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings