# How do I test in a workflow task how I am triggered?

**URL:** <https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658>\
**Category:** Automations\
**Tags:** workflows, automations\
**Created:** [July 17, 2024, 2:58pm UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658 "2024-07-17T14:58:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [July 17, 2024, 2:58pm UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658/1 "2024-07-17T14:58:09Z")

</div>

Hello “workflow friends”,

Can you select to run a task based on the trigger e.g. “Manual trigger or Event trigger”.

Or can I select this within the js?

KR Henk

---

<div class="post-metadata">

**Author:** ![Cameron-Leong](https://avatars.discourse-cdn.com/v4/letter/c/54ee81/32.png) [@Cameron-Leong](https://community.dynatrace.com/u/Cameron-Leong)\
**Post date:** [July 17, 2024, 11:07pm UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658/2 "2024-07-17T23:07:42Z")

</div>

Hello,

If you want to know what type of trigger the workflow is using, it is shown in the label on the first tile.

 ![CameronLeong_0-1721257523060.png](https://global.discourse-cdn.com/dynatrace/original/2X/7/7ec1fbd0190f3262e69b52fd29ac3ad7f73f4064.png)

 ![CameronLeong_1-1721257525080.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/c/1c2fc1eac77c36bd5196b827a56580a87a00dec5.png)

If you set an event trigger, you still have the option to manually trigger an execution by hitting “Run” at the top.

 ![CameronLeong_2-1721257631239.png](https://global.discourse-cdn.com/dynatrace/original/3X/2/a/2a6e3c3a87997a310cda1061c07df4db018cc508.png)

Thanks

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [July 18, 2024, 7:06am UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658/3 "2024-07-18T07:06:52Z")

</div>

Hello&nbsp;&nbsp;[Cameron-Leong,](https://community.dynatrace.com/user/54146)

Thanks for your reply!

But what I like to know if the same information is available from within the workflow e.g.

If you have a manual trigger, can you skip a task based on this info,

Thanks Henk

---

<div class="post-metadata">

**Author:** ![wolfgang\_heider](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/wolfgang_heider/32/12831_2.png) [@wolfgang\_heider](https://community.dynatrace.com/u/wolfgang_heider)\
**Post date:** [July 18, 2024, 2:10pm UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658/4 "2024-07-18T14:10:21Z")

</div>

The team provided a solution via a JS task that looks promising to me:

```c-mrkdwn__pre
import { executionsClient } from "@dynatrace-sdk/client-automation"; export default async function ({ execution_id }) { const executionInfo = await executionsClient.getExecution({ id: execution_id, }) return { triggerType: executionInfo.triggerType }; }

```

The result would be a property named&nbsp;`triggerType`&nbsp;with a value like&nbsp;`Manual`&nbsp;.If you like to do it with the automation-utils, you could also write

```c-mrkdwn__pre
import { execution } from '@dynatrace-sdk/automation-utils'; export default async function ({ execution_id }) { const ex = await execution(execution_id); return { triggerType: ex.triggerType }; }

```

In following actions you can add the conditions referencing to the result of this JS action.Does that help?

---

<div class="post-metadata">

**Author:** ![henk\_stobbe](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/henk_stobbe/32/30434_2.png) [@henk\_stobbe](https://community.dynatrace.com/u/henk_stobbe)\
**Post date:** [July 18, 2024, 2:15pm UTC](https://community.dynatrace.com/t/how-do-i-test-in-a-workflow-task-how-i-am-triggered/46658/5 "2024-07-18T14:15:27Z")

</div>

Wolfgang.

Yes this will help (-; Thanks to you and the team,

KR Henk
