Query workflow running on a different client with the workflow id

I would like to query a workflow running on a different client with the workflow id. Is there a way to do that in typescript. I found similar topic in java Getting workflow status/results with just the workflow/run id in a different client but unable to figure out to get it done in typescript

You should be able to do the same via external workflow handle (inside workflow code), for example:

const external = await workflow.getExternalWorkflowHandle(workflowId);
try {
  await external.signal(...);
} catch (err) {
 // ...
}

Thank you for the response. I tried this and then I am getting the Workflow uninitialised error even when the workflow is registered with the worker. Below is part of the stack trace if that will be helpful

"stackTrace": "IllegalStateError: Workflow uninitialized\n    at getActivator (/path/node_modules/@temporalio/workflow/src/internals.ts:692:11)\n    at getExternalWorkflowHandle (/path/node_modules/@temporalio/workflow/src/workflow.ts:577:33)\n,

workflow.getExternalWorkflowHandle() is only meant to be used from Workflow code. It seems like this is not your case. Use Client.workflow.getWorkflowHandle(...).signal(...) to send signals from other context.

Also, make sure that you are using the latest version of TS SDK (v1.8.6). The error message and stack trace suggests you are using 1.7.4 or earlier.

Noted that we cannot use getExternalWorkflowHandle. Will look for alternate approaches. Thank you for the inputs. @tihomir @jwatkins