How to update a workflow memo in golang?

I could not find anything regarding mutability of workflow memo and if it is possible to update it.
Could someone explain how to do that?

Yes, you can update Memo: https://github.com/temporalio/samples-go/blob/main/memo/memo_workflow.go#L55

Note, as a visibility record the update is eventual consistent:

The example you have pointed to is from the starter code side of things and the workflow execution has not started yet.

Let’s say I am creating a workflow client and have a (workflow_id, namespace). Is it possible to update the existing Memo on the workflow?

The example you have pointed to is from the starter code side of things and the workflow execution has not started yet.

Not really. Please see the first link that’s points at the line where workflow.UpsertMemo is called from a workflow definition.

Let’s say I am creating a workflow client and have a (workflow_id, namespace). Is it possible to update the existing Memo on the workflow?

Absolutely, you can use Signal or Workflow Update then call workflow.UpsertMemo in the handler.

ok. I will try to elaborate my usecase a bit.

I’m trying to enforce server side validations on workflow using grpc-proxy interceptors (i.e. conceptually similar to https://github.com/temporalio/samples-go/tree/main/grpc-proxy/proxy-server) on frontend requests.

So the limitation is I do not have control over workflow implementation to add signal handlers to the workflow.

As part of grpc interceptor, I can view the Memo.

memo := req.(*workflowservice.StartWorkflowExecutionRequest).Memo

In the next step, I want to update the Memo for that workflow. I could try creating an instance of
common.Memo but I’m afraid this would be very dependent on the Memo’s proto definition version i.e.

req.(*workflowservice.StartWorkflowExecutionRequest).Memo = common.Memo{...}

But I am looking for answers that leverage the api (e.g. workflow client) to update the Memo of such a workflow.

Hi Durga,

I checked this with our team. It is not advisable to modify Memo in proxy as this will raise a few consistency issues. Memo is meant to be updated by Workflows.

I understand you do not have control over workflow implementation. Another option is to implement a generic Memo upsert function through a Signal handler in an Interceptor. From there all you need is to configure the interceptor on the worker without changing the Workflow definition.

Hi Tao,
For our case, the worker implementation is also defined by teams that use our platform.
Therefore we are using grpc server-side interceptors instead of worker interceptors.