Managing Timeouts in Scenarios

Desktop SDK implements timeout management within scenarios.

Tips to Manage Errors and Timeout

  • Do not use onError and onTimeout to manage errors

    The onError and onTimeout callbacks are technical callback, once the machine reach these callbacks it’s too late, you must stop your automation.

    Using these callbacks you always must stop the scenario with sc.endScenario(), if you try to continue the workflow, it will cause trouble in the state machine.

    Instead of using these callbacks, it's recommended to close applications, close instance of excel, and write the error in a custom error log.

  • Use Try Catch to manage technical errors

    To manage error in a scenario that never fails or same scenario with some other actions, you must add the step code with a try catch in every step.

  • Use ctx.wait to manage timeout on step

    To manage timeout, it's recommended to use ctx.wait, if you add a sc.endStep in this block the endStep instruction of the step will not be executed.

    It’s an excellent way to manage the timeout. The delay of the ctx.wait must be lower than the timeout of the step (by default 30 seconds)

  • Use sub-automations

    You must add the below code on every step.

    The best way to manage these errors is to use sub-automations and use the sc.code result. When you use a sub-automation you can retrieve the result code of the sub-automation to try again or do other actions. In the sub-automation no need to add ctx.wait or try catch, onError and onTimeout callback will be executed in the sub-automation and the result code will be affected.

Different solutions exist to manage different types of timeouts: For more information about Error Timeout Waiting for Script Execution in SAP Intelligent RPA, see the following note 2999270 Information published on SAP site