A process travels in a solution
A process moves between environments the way everything else does: in its solution, with its table, its form, its app and its roles. Import publishes it, and uninstall takes it out again. Trying that with a run still waiting, we fixed what happens to the run: it's now stopped, and its history says why.

A process is built in one environment and used in another. Nobody redraws it in Production; it moves there in its solution, with everything it needs to run: the table its requests are kept in, the form a step opens, the app people work in, and the roles its steps go to.
We moved the Leave Approval sample from samples/solutions/bpms-leave-approval-process, the
process from Leave approval from start to finish,
out of the Claims environment and into a new one called HR Pilot. Then we ran it there, and took
it out again with a request still waiting.
What's in the solution
In the maker portal, open Solutions and the solution. The tabs list what it holds:

The process is one component, beside the Leave request table, the app, and two roles:

Its coforms, the short forms each step shows, aren't listed separately: they're part of the process, and travel inside it.
Export
Select Export. The browser saves one file, Leave Approval — a BPMS Process-1.0.0.json. It
holds every component in full, not a reference to them, so the environment it goes to doesn't need
to reach this one. The process is in it as its drawing, the same plain text you see with Export
JSON in the designer (Export and import a process).
Import
Switch to the other environment at the top of the maker portal, open Solutions, select Import and choose the file:

It arrives managed: installed, not for editing here. The table is created, the app and roles are in place, and the process is published:

There's nothing to publish by hand. An import is a deployment: whoever imports a solution is putting a finished process into the environment, not opening a draft. Each environment keeps its own versions, because each has its own runs, so this is version 1 here whatever it is in Claims.
Run it
Nothing about running it is new. In HR Pilot, Robin Park asked for a week off and sent it. The request went to the Manager role, and Sam Taylor found it in their tasks:

Robin and Sam already held Employee and Manager. Security roles belong to the tenant, not to one environment, so a person who holds one holds it everywhere the role exists.
Uninstall
Uninstalling a managed solution takes its components back out: the process, the app, and the table with its records. We did it while Sam's task was still waiting. Select the solution and Uninstall:

Any run of its processes that's still going is stopped. Its open tasks leave everybody's list, and its history says why. A run whose process has gone can never move again, so it isn't left waiting for one.
If people still held a role the solution created, the uninstall would stop first and name it. It didn't here: Employee and Manager came into the tenant with an earlier import, so this one didn't create them, and they stay.
That's new. Before, the uninstall removed the process and left its runs running. Sam's task vanished with the app. Then, when we imported the solution again, it was back in Sam's list, about a leave request the uninstall had already deleted with its table.
The history stays
A run's history isn't thrown away with the process. Import the solution again, open the process's Runs, and the stopped run is there:

It's Cancelled, it stopped at Review Request, and the last two lines say why. It doesn't start again: the leave request it was about went with the table, and a cancelled run stays cancelled.
Before you uninstall
- Finish the runs that matter. If a request is half-way through and its outcome matters, let the people finish it, or stop it yourself from its run's page and record why.
- Keep the records you still need. A table only this solution brought leaves with its records, and nothing brings them back. If some must survive, move them into a table that isn't going away first.
- Uninstall where it was imported, not where it was built. In the environment you built it in, the solution is unmanaged, and you delete it instead: that removes the solution and keeps everything that was in it.
Upgrading a process that is in use
Uninstalling is the exception. The everyday case is a new version: you change the process in Development, raise the solution's version, export and import it over the installed one.
- In Development, change the process and Publish it there to try it.
- On the solution's overview, Set version, for example from 1.0.0 to 1.1.0.
- Export, and import the file into Test, then Production.
The import publishes the new process as the next version in each environment. Runs already going finish on the version they started on; runs started after the import use the new one. So a leave request waiting for a manager when the new version arrives is decided exactly as it would have been, and the next request follows the new rules. Publish a process explains versions, and Moving work from Dev to Test to Prod the upgrade itself.
What a process needs to travel
A process is rarely useful on its own, and the import checks that what it depends on will be there:
| The process uses | It must be |
|---|---|
| The table its runs are about | In the same solution, or already in the environment |
| The form or report a step opens | In the same solution, or already installed |
| The roles its steps go to | In the same solution, so assignments resolve on arrival |
| A process it calls | In the same solution, or in one imported first |
| An environment variable a step reads | Declared in the solution, and set in each environment by hand |
The sample carries everything in one solution, which is the simplest arrangement and the one to copy. When a process depends on a table from another solution, that solution is imported first; a solution can say so with a requirement, and an import in the wrong order is refused with Import … first.
After the import: three checks
- Open the process in the target environment. The line under the title should say the version is running.
- Check who holds the roles. The roles arrive; who holds them is each environment's decision. In a fresh environment, give them to the right people, and for lanes answered from the organisation, fill in Process Roles.
- Run it once with a real record, as above, and watch the first task arrive.
Questions that come up
Can I edit an imported process in Production? No: it arrives managed. Change it where it was built and bring the change across, so every environment runs a process somebody reviewed.
Do runs move between environments? No. Runs belong to the environment they started in, with that environment's records. Only the process's design travels.
Try it
Import the Leave Approval sample into one environment and export it. Create a second environment, import the file there, and start a leave request. Uninstall the solution while it waits, import it again, and open the run.
Next: the Graphic Designer, the canvas screens and reports are drawn on.