Support list latest workflow distinct by workflow id

Many time user only care about latest workflow running status, will temporal support list latest workflow distinct by workflow id for easy access current workflow running status info list?

Hi, can you clarify if you are talking about temporal web ui, cli, or sdk apis?

With tctl you could use tctl wf list with page size set to 1, for example:

tctl wf list -q "WorkflowId='<your_workflow_id>'" --ps 1

Can do same with sdk apis. In web you can use advanced search to specify advanced search queries which could help as well.

We are using sdk apis get current workflow status list for our users. Advanced search queries need hack in es aggregation. We hope temporal could support this feature directly in the future.

Which Temporal SDK are you using?

We are using go SDK. But advanced search latest workflow base on es, cannot be implemented by sdk
ListWorkflow api query.

Our user case is starting a batch of long running workflow to handle data processing, may crash at some activity then reset serveral times workflows. To show clearly user interface get latest workflow running status and running stage (search attributes). (Not really related to cron job).

That feature would work for workflow chains created for any reason.

IMHO using reset to deal with an activity failure is overkill.

Workflow reset is really a nice feature to handle long running workflow. Even the workflow failed at some point, users could check code or running environment, fix and continue the long running workflow without restart the whole workflow (this may be really expensive).

1 Like

Current temporal write into ES doc id compose of workflow id and run id.
For get latest workflow (dual es store), write a workflow id as doc id into another es store
may be easier.

func getDocID(workflowID string, runID string) string {
	// From Elasticsearch doc: _id is limited to 512 bytes in size and larger values will be rejected.
	const maxDocIDLength = 512
	// Generally runID is guid and this should never be the case.
	if len(runID)+len(delimiter) >= maxDocIDLength {
		if len(runID) >= maxDocIDLength {
			return runID[0:maxDocIDLength]
		return runID[0 : maxDocIDLength-len(delimiter)]

	if len(workflowID)+len(runID)+len(delimiter) > maxDocIDLength {
		workflowID = workflowID[0 : maxDocIDLength-len(runID)-len(delimiter)]

	return workflowID + delimiter + runID

Assume you are referring to the server code here.
Do you mind opening an issue on the server repo for the suggested possible improvement? Thanks.

Yeah, I am reading the server code looking for a quick and possible solution.
But I am not very sure that is a fine solution.