submitConfig()

The submitConfig() function (client-side) submits a configuration and determines what happens after submitting it and where the configuration is submitted. At the end of the processing, this function saves the transaction.

Syntax

Use this syntax for the submitConfig() function:

            submitConfig({
    afterSubmitAction: string,
    target: string,
    saveConfig: true | false
}).done(callback); 

          

The callback is optional.

Return Value

The submitConfig() function returns a promise that resolves to an object containing the configid key, which is the configuration record ID. The returned object contains the following information:

            {configid: string} 

          

Parameters

Note:

All properties are optional.

The submitConfig() accepts an object as a parameter. The object includes the following properties:

  • afterSubmitAction - Determines what happens after submission. This property can take the following values:

    • close - Submits the configuration and closes the product interface. This is the default value.

    • copy - Submits the configuration, doesn't reset questions and answers, and runs all actions that include SOLE/CFGSTATUS[="STARTUP"] in their rule.

    • new - Submits the current configuration, resets questions and answers, and runs all actions that include SOLE/CFGSTATUS[="STARTUP"] in their rule.

    • none - Creates the configuration record and doesn't run any tasks after submitting the configuration. Users can continue their configuration.

  • target - Determines where the configuration is submitted. This property can take the following values:

    • trandb - Submits the configuration to the database and creates or saves the transaction.

    • tranpage - Submits the configuration to the transaction page. The transaction isn't saved.

    • none - Creates the configuration without submitting it to the transaction or applying any changes to the transaction.

    • ext - Submits the configuration to an external implementation, for example, a SuiteCommerce web store.

    Note:

    The default value of the target property depends on the environment for which the submitConfig() function runs. If the function runs for an external implementation the default value is ext. Otherwise, the default values depends on whether the Submit to transaction page box is checked on the options record at CPQ > Configurator > Settings. If the box is checked, the default value is tranpage. If it's not checked, the default value is trandb.

  • saveConfig() - Saves the configuration. This property defaults to true.

Examples

The following examples show how to use the submitConfig() function.

Submitting and Copying the Configuration

This example submits the current configuration and opens a copy.

              submitConfig({
    afterSubmitAction: 'copy'
}).done(function(data) {
    console.log(data);
}); 

            

The output in the console may look like this:

              {configid: "345"} 

            

You can also submit the configuration to the transaction page and create a copy. See the following example:

              submitConfig({
    afterSubmitAction: 'copy',
    target: 'tranpage'
}); 

            

Submitting the Configuration and Closing

This example submits the configuration and closes the product interface.

              submitConfig({
    afterSubmitAction: 'close'
}); 

            

If you omit all object properties, the function produces the same result.

              submitConfig(); 

            

Submitting the Configuration and Starting a New One

This example submits the current configuration and starts a new configuration session.

              submitConfig({
    afterSubmitAction: 'new'
}); 

            

You can also submit the configuration to the database and start a new one.

              submitConfig({
    afterSubmitAction: 'new',
    target: 'trandb'
}); 

            

Creating a Configuration

This example creates a configuration record without submitting it and doesn't perform any task after the submission.

              submitConfig({
    afterSubmitAction: 'none',
    target: 'none'
}); 

            

Related Topics

General Notices