Skip Navigation
Expand
Trouble accessing custom configuration settings from Customer Portal Framework version 3
Answer ID 6578   |   Last Review Date 01/20/2019

Why am I having intermittent trouble accessing custom configurations using the Config::getConfig method? 

Environment:

Customer Portal framework version 3 (CPv3)
Oracle Service Cloud

Issue:

I am trying to use the Config::getConfig method of the Customer Portal 3 API to retrieve the values of custom configuration settings. It works inconsistently, occasionally throwing a failure message.

Resolution:

Per development, Config::getConfig in Customer Portal framework version 3 was not designed to support retrieval of custom configuration settings. As such, it should not be used for this purpose as it is not guaranteed that it will work correctly. Here is a link to the relevant API page for November 2013 for reference:

Customer Portal API Documentation

However, starting in the August 2013 release, configuration settings (including custom ones) were made available through our Connect PHP API. As such, one should leverage that API for custom configuration retrieval. Here is some sample code from the Connect PHP documentation to give you an idea of how this might look (please see the full Oracle RightNow Connect PHP API Cloud Service documentation for your version for more information):

try{
// To use the predefined names for custom Configuration settings
require_once( get_cfg_var( 'doc_root' ) . '/include/config/config.phph' );
// Fetching by ID
$cfg = RNCPHP\Configuration::fetch( 1000007 );
// Fetching by ID using predefined values for configs
$cfg2 = RNCPHP\Configuration::fetch( CUSTOM_CFG_TEST_SITE_INT_DefaultSameMinMax );
// Fetching by Name
$cfg3 = RNCPHP\Configuration::fetch( "CUSTOM_CFG_TEST_SITE_INT_DefaultSameMinMax" );
echo "My ID: {$cfg->ID}, {$cfg2->ID}, and {$cfg3->ID}\n";
echo "My Value: {$cfg->Value}, {$cfg2->Value}, and {$cfg3->Value}\n";
echo "My DataType: {$cfg->DataType->LookupName}, {$cfg2->DataType->LookupName}, and {$cfg3->DataType->LookupName}\n";
}
catch (Exception $err ){
echo $err->getMessage();
}

 

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.