# How do we start sync workflow, wait for result and then continue long running work - NextJS

**URL:** <https://forum.camunda.io/t/how-do-we-start-sync-workflow-wait-for-result-and-then-continue-long-running-work-nextjs/52922>\
**Category:** Camunda 8 Topics\
**Tags:** process-engine, workflow-execution, zeebe\
**Created:** [June 4, 2024, 11:19pm UTC](https://forum.camunda.io/t/how-do-we-start-sync-workflow-wait-for-result-and-then-continue-long-running-work-nextjs/52922 "2024-06-04T23:19:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![oegma2](https://forum.camunda.io/letter_avatar_proxy/v4/letter/o/df788c/32.png) [@oegma2](https://forum.camunda.io/u/oegma2)\
**Post date:** [June 4, 2024, 11:19pm UTC](https://forum.camunda.io/t/how-do-we-start-sync-workflow-wait-for-result-and-then-continue-long-running-work-nextjs/52922/1 "2024-06-04T23:19:43Z")

</div>

**What language**  
NextJS using - '@camunda8/sdk

**What the problem?**  
How do we start a workflow with sync call (_createProcessInstanceWaitForResult_), get the result from our workflow to update our UI and then let the process continue with the long running work?

**Some example with code and BPMN**  
In the BPMN workflow example below, the Request Order will trigger the workflow using this code. And will wait for a result. Catch is, one of the service\_task at the end takes up to 5 days to complete. That means this …WaitForResult will never return fast enough for the UI to update.

```auto
    const newProcessStarted = await this.getZeebeInstance().createProcessInstanceWithResult({
      bpmnProcessId: `OrderProcess`,
      variables: {
        productList: ["ProductA", "ProductB", "ProductC"],
      },
    });

```

 ![image](https://forum.camunda.io/uploads/default/original/3X/1/f/1f2fdfcc076297beb97d7dbbfdfe8a15a05e0c74.png)

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [September 2, 2024, 11:19pm UTC](https://forum.camunda.io/t/how-do-we-start-sync-workflow-wait-for-result-and-then-continue-long-running-work-nextjs/52922/2 "2024-09-02T23:19:59Z")

</div>

Closed on September 2, 2024, 11:19pm UTC

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
