Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(error-tracking): start a workflow from an issue (#112988)

Daniel Marchukc6958ffa385a
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/ErrorTrackingIssueScenePanel.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/ErrorTrackingIssueScenePanel.tsx
index 8a577aa12039..215ee6bba9ee 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/ErrorTrackingIssueScenePanel.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/ErrorTrackingIssueScenePanel.tsx
@@ -26,6 +26,7 @@ import { ExternalReferences } from '../../../components/ExternalReferences'
import { manageFingerprintsLogic } from '../../../components/FingerprintPreview/manageFingerprintsLogic'
import { errorTrackingIssueSceneLogic } from '../errorTrackingIssueSceneLogic'
import { IssueCohort } from './IssueCohort'
+import { IssueWorkflowButton } from './IssueWorkflowButton'
export const ErrorTrackingIssueScenePanel = ({
issue,
@@ -44,6 +45,7 @@ export const ErrorTrackingIssueScenePanel = ({
<ScenePanelDivider />
<ScenePanelActionsSection>
<CreateSurveyButton />
+ <IssueWorkflowButton issueId={issue.id} />
<SceneComment dataAttrKey="issue" />
<SceneShareButton
dataAttrKey="issue"
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/IssueWorkflowButton.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/IssueWorkflowButton.tsx
new file mode 100644
index 000000000000..6d4528dcf13f
--- /dev/null
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingIssueScene/ScenePanel/IssueWorkflowButton.tsx
@@ -0,0 +1,41 @@
+import { router } from 'kea-router'
+
+import { IconSend } from '@posthog/icons'
+
+import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
+
+import { captureMessageAudienceClicked } from 'products/workflows/frontend/MessageAudience/messageAudience'
+import {
+ type WorkflowTriggerConfig,
+ urlForNewWorkflowWithTrigger,
+} from 'products/workflows/frontend/Workflows/workflowTriggerPrefill'
+
+// pinned: reported as the click event's source, so renaming it splits the entry point's history
+const SOURCE = 'error_tracking'
+
+function issueWorkflowTrigger(issueId: string): WorkflowTriggerConfig {
+ return {
+ type: 'event',
+ filters: {
+ events: [{ id: '$exception', name: '$exception', type: 'events' }],
+ properties: [{ key: '$exception_issue_id', value: issueId, operator: 'exact', type: 'event' }],
+ },
+ }
+}
+
+export function IssueWorkflowButton({ issueId }: { issueId: string }): JSX.Element {
+ return (
+ <ButtonPrimitive
+ fullWidth
+ tooltip="Open a new workflow that runs each time someone hits this issue"
+ onClick={() => {
+ captureMessageAudienceClicked(SOURCE, 'workflow')
+ router.actions.push(urlForNewWorkflowWithTrigger(issueWorkflowTrigger(issueId)))
+ }}
+ data-attr="issue-panel-start-workflow"
+ >
+ <IconSend />
+ Start a workflow on this issue
+ </ButtonPrimitive>
+ )
+}