Skip Navigation
Expand
Retrieving custom message bases in report column headers
Answer ID 10264   |   Last Review Date 03/19/2019

How can I make use of custom scripts to retrieve the custom message bases in my report column headers?

Environment
 
Analytics, Custom reports, Custom scripts
Oracle B2C Service versions 20C and earlier
 
Resolution

This content is applicable for Oracle B2C Service up through version 20C. For versions 20D and later, see Answer ID 11780: Custom Scripts Replacement by Analytics Extensions for best practices.

When designing a custom script to run on a report, in order to have custom message bases populate the column headers, the steps and code below can be used as guidelines.

 
1. Access the report in Design Mode and click on Level -> Custom Scripts
 
2. In the Initialization tab add the script below, calling the Connect API:
require_once(get_cfg_var('doc_root')."/include/ConnectPHP/Connect_init.phph");
initConnectAPI();
 
3. In the headers tab use the script below, passing the values of the custom message bases in the column headers:
$msg = RightNow\Connect\v1_2\MessageBase::fetch(NAME_OF_THE_CUSTOM_MSG_BASE);
$msg1= RightNow\Connect\v1_2\MessageBase::fetch(NAME_OF_THE_CUSTOM_MSG_BASE); 
$msg2= RightNow\Connect\v1_2\MessageBase::fetch(NAME_OF_THE_CUSTOM_MSG_BASE); 
......(the rest of the variables needed to retrieve all custom message base values needed in the script)
$headers[0] = $msg->Value;
$headers[1] = $msg1->Value;
$headers[2] = $msg2->Value;
...(the rest of the parameters that pass the value of the message bases retrieved to the report column headers)
 
Notes
The headers parameter in the script acts as an array that contains the column headers for the report, consequently the values for each custom message base used will need to be retrieved starting from the [0] position. If the report uses drill down levels and the script needs to run on each of them, the custom script needs to be added on each and every report level.

 
For more information, refer to Answer 2284: Using custom scripts with reports.
Notify Me
The page will refresh upon submission. Any pending input will be lost.