# Using newExternalWorkflowStub correctly?

**URL:** <https://community.temporal.io/t/using-newexternalworkflowstub-correctly/571>\
**Category:** Community Support\
**Tags:** java-sdk\
**Created:** [September 4, 2020, 7:33pm UTC](https://community.temporal.io/t/using-newexternalworkflowstub-correctly/571 "2020-09-04T19:33:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mtruong](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@mtruong](https://community.temporal.io/u/mtruong)\
**Post date:** [September 4, 2020, 7:33pm UTC](https://community.temporal.io/t/using-newexternalworkflowstub-correctly/571/1 "2020-09-04T19:33:56Z")

</div>

Hello!  
We tried using newExternalWorkflowStub within a current running workflow (as opposed to continueAsNew) to kick off another workflow so we can pass in a new workId. We saw an error stating

```
Caused by: java.lang.IllegalStateException: Cannot start a workflow with an external workflow stub created through Workflow.newExternalWorkflowStub

```

We were wondering if we used newExternalWorkflowStub correctly? Or is there another way to start a new workflow within a workflow with passed in workId?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [September 4, 2020, 9:36pm UTC](https://community.temporal.io/t/using-newexternalworkflowstub-correctly/571/2 "2020-09-04T21:36:24Z")

</div>

Use `Workflow.newExternalWorkflowStub` for connecting to an already running workflow.  
Use `Workflow.newChildWorkflowStub` to create a stub that can be used to start a new child workflow.

[Here is](https://docs.temporal.io/docs/java-implementing-workflows#child-workflows) the relevant section of the documentation.
