Update the Logic of Pending Workflow

Hi,
I want to ask a question related to expense sample which defined in here samples-go/expense at main · temporalio/samples-go · GitHub

Let’s say I implemented this and deploy to production and everything is working fine. A week later I decided to define a threshold for expenses. Let’s say if expense amount is lower that $50 , no need to send to human approve. Just skip that step and complete workflow. Otherwise leave the logic as is.
This can be implemented simple if else statement. But due to non deterministic error situation, my workflows which are being waited to be approved will be affected. Because they didn’t have that logic in the first place.

What is the best practice of this scenario ? At general I want to be able to update existing workflow logics which are waiting to be approved by client.CompleteActivity call

1 Like

What you describe is a case for Workflow Versioning.

The Workflow Versioning feature enables the creation of logical branching inside a Workflow Definition based on a developer specified version identifier. This feature is useful for Workflow Definition logic needs to be updated, but there are running Workflow Executions that currently depends on it.

This page describe how to use this feature in Go.

Thanks for your reply.
I will take a look to workflow versioning :+1: