How to add Temporal server side validation for workflow and activities?

Hi Team,
We are using Temporal in Salesforce.
How do we add certain validations that would be enforced on each and every workflow that runs on the temporal server? (i.e. obviously with the assumption that there would certain argument that is passed onto the workflow that can be used in running those temporal server-side validations)

I looked at interceptors. As per my understanding, interceptors are added to temporal worker during its initialisation. Therefore, it remains as per users’ choice whether they want to use those interceptors. So, I feel having those validations as part of interceptors leaves us in a state where we have those validations as a guidance and not as a mandatory step.

As per my understanding, interceptors are added to temporal worker during its initialisation. Therefore, it remains as per users’ choice whether they want to use those interceptors.

For your use case do you have a multi-tenant system where your clients (users) stand up their own workers, or do you control workers?

We have a multi-tenant (different namespaces) temporal for our onboarded users. The clients launch and manage their own workers.

If your clients deploy and manage workers, maybe you can provide a library that they should use to create workers, in this lib you can provide the interceptors impl and maybe some wrapper method(s) that use temporal apis to create workers (and register your interceptors), just idea.

okay. Yes I was thinking in that direction.

Apart from that, is there “any other way” to add temporal server side validations/hooks that get trigger selectivity for certain kind of user workflows? We can then latch onto them for triggering some other child workflows that can run some validation activities.

Not that I am aware of. If your client has control over workflow execution (workers) and communication with cluster(s) you manage, think this is something you would need to abstract via some custom lib.