Working with Product Configurations

The product configuration gathers the selections made by users for a specific configurable item. Configurations are stored on the configuration record. To view the configuration record, click the Access Config Record button on the configured item line on transactions.

Any user with advanced permissions can view the configuration record and its ID. To set role permissions, go to the Access subtab on the employee record. Then, select Advanced in the CPQ Configurator Permissions field and save the record.

Note:

Users with an administrator role are assigned advanced permissions by default without setting this field.

You can also view the configuration ID directly on transactions. In the Configurator Data line field, look for the value of the configId parameter.

The configuration record stores the configuration in a compressed format. You can use a RESTlet endpoint to retrieve the compressed configuration using custom client and server scripts. After taking the configuration ID as a parameter, the endpoint searches for the record, and returns the decompressed configuration as a string. You can then convert this string into a JSON object if needed.

In client scripts, use the _nHttps.post() method from the N/https module. The syntax is:

          const response = _nHttps.post({
  url: _nUrl.resolveScript({
   scriptId: 'customscript_cpqc_rs_maint',
   deploymentId: 'customdeploy_cpqc_rs_maint'
  }),
  body: {
   task: 'getConfiguration',
   configurationId: id_number
  }
}); 

        

See the following example:

          const response = _nHttps.post({
  url: _nUrl.resolveScript({
   scriptId: 'customscript_cpqc_rs_maint',
   deploymentId: 'customdeploy_cpqc_rs_maint'
  }),
  body: {
   task: 'getConfiguration',
   configurationId: 501
  }
});
 
console.log('Parsed configuration: ', JSON.parse(response.body)); 

        

In server scripts, use the _nHttps.requestRestlet() method from the N/https module. The syntax is:

          const response = _nHttps.requestRestlet({
  scriptId: 'customscript_cpqc_rs_maint',
  deploymentId: 'customdeploy_cpqc_rs_maint',
  method: 'POST',
  body: {
   task: 'getConfiguration',
   configurationId: id_number
  }
}); 

        

See the following example:

          const response = _nHttps.requestRestlet({
  scriptId: 'customscript_cpqc_rs_maint',
  deploymentId: 'customdeploy_cpqc_rs_maint',
  method: 'POST',
  body: {
   task: 'getConfiguration',
   configurationId: 501
  }
});

console.log('Parsed configuration: ', JSON.parse(response.body)); 

        

Related Topics

General Notices