processRecordCreations()

The processRecordCreations() function (client-side) creates records required by the configuration using all active creation records. Active creation records have a rule that matches user's choices on the product interface. The new records are saved in your account.

You can also verify that records have been correctly created, and use the console to view how records would be created to troubleshoot any possible issue. For more information about creation records, see Creating Records Required by the Configuration.

Syntax

Use this syntax for the processRecordCreations() function:

            processRecordCreations({
    mode: 'create' | 'log'
}).then(callback);
  .catch(callback); 

          

Return Value

The processRecordCreations() function returns a promise that resolves to an object containing the results of the record creation process.

Parameters

Note:

All properties are optional.

The processRecordCreations() function accepts an object as a parameter. The object includes the mode property (string), which specifies how active creation records are processed. This property can take the following values:

    • create - Creates records from active creation records during the configuration process. This is the default mode.

    • log - Uses the console to log the record that would be created to troubleshoot any possible issue.

Examples

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

Creating Records Required by the Configuration

This example runs the creation of records in create mode, which creates the required records. When the promise resolves, the function logs the returned data to the console. Use this approach when the configuration must produce real records.

              processRecordCreations({
    mode: 'create'
}).then(data => {
    console.log('Done', data);
}); 

            

Logging Records That Would Be Created

This example runs in log mode, so no records are created. Instead, the function prints details to the console showing which records would be created. Use this approach to verify that creation records will be processed correctly.

              processRecordCreations({
    mode: 'log'
}).then(data => {
    console.log('Done', data);
}); 

            

Related Topics

General Notices