Initializing help system before first use

# Executing a Scenario

You can execute individual scenarios using the JS API.

There are two ways to do this: from a scenario object you have loaded via a `ScenarioObserver` or from the view object, passing in a scenario id. In both cases you can specify the execution mode to submit the job with, this defaults to RUN. Both methods submit the execution job asynchronously and return a Promise object which resolves when the job has been successfully submitted or gets rejected if the job could not be queued.

The following is an example of executing a scenario directly from the scenario object. It uses a custom execution mode named FAST_MODE:

    insight.getView().withFirstScenario()
            .withSummaryData()
            .notify(function (scenario) {
                scenario.execute('FAST_MODE')
                        .then(function () {
                            console.log('scenario successfully queued');
                        })
                        .catch(function () {
                            console.error('scenario failed to queue')
                        })
            })
         .start();

The next example executes a scenario from outside of a `ScenarioObserver`. First it looks up the `id` of the first scenario in the selection. Then it uses that together with the custom execution mode name, FAST_MODE:

    var view = insight.getView();
    view.getScenarioProperties(0)
            .then(function (props) {
                return props.getId();
            })
            .then(function (scenarioId) {
                return view.executeScenario(scenarioId, 'FAST_MODE');
            })
            .then(function () {
                console.log('scenario successfully queued');
            })
            .catch(function (error) {
                console.error('scenario failed to queue');
            });

Parent Topic Modifying Scenario Data

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.