---
url: >-
  /statelake/scripting-reference/functions-and-procedures/program-control-functions/stopexecutionassuccess.md
---

# StopExecutionAsSuccess

**StopExeutionAsSuccess** cancels the execution of the **Map** (or **Custom Script**) immediately after the current script, and by default, cancels any subsequent step(s) in that **Action**.

Any code lines in the script following this function will still be executed. Use **Exit** to stop the processing of the remainder of the script. Please review [Exit](/statelake/scripting-reference/functions-and-procedures/program-control-functions/exit) for more information.

With similar functionality to the **StopExecution** procedure, using this procedure will cause the status of the **Action** to be set to successfully completed (for **Logs** and notifications), and the **Log** will be **GREEN**.

Please also review [StopExecution](/statelake/scripting-reference/functions-and-procedures/program-control-functions/stopexecution) for more information about the **StopExecution** procedure.

If the **Action** has one or more **Action Steps**, any subsequent step(s) will not execute. This is the default behaviour.

To allow execution of any subsequent **Action Step**, either see below, or use the **CancelExecution** procedure. Refer to [CancelExecution](/statelake/scripting-reference/functions-and-procedures/program-control-functions/cancelexecution) for more information.

**Declaration**: Procedure StopExecutionAsSuccess;

An example is as below.

```pascal
procedure ScriptEvent(var Value:Variant);
var aInt :integer;
begin
  aInt := 2;
 if aInt <> 10 then
 begin
    LogInfo('This is the 1st line before STOP.');
    LogInfo('This is the 2nd line before STOP.');
    LogInfo('Next line will STOPEXECUTION. . . .');

    StopExecutionAsSuccess;                  //subsequent lines will ALL execute;
    LogInfo('This is the 1st line after STOP.');
    LogInfo('This is the 2nd line after STOP.');
    LogInfo('Next line will EXIT . . . .');

    Exit;                                   //subsequent lines will NOT execute;
 //processing has now ceased and nothing further will execute
    LogInfo('This is the 1st line after EXIT.');
    LogInfo('This is the 2nd line after EXIT.');
 end;
end;
```
