Skip Navigation
Expand
How to use sql_prepare in a CPM object event handler script
Answer ID 6700   |   Last Review Date 07/22/2019

Why is sql_prepare() not working in my object event handler code?

Environment:

Process Designer, Custom Process Model (CPM), Service Process Model (SPM)
November 2012 and newer releases

Resolution:

You are planning on using direct sql and you have made arrangements for the necessary safelisting.

If you want to enable the use of sql_prepare(), you must include this line in your script above the class declaration and below the use statements.

require_once '/cgi-bin/<interface>.cfg/scripts/include/src/rnwintf.phph';

Example:

// This object event handler binds to the v1 interface of the
// Custom Process Model
use \RightNow\CPM\v1 as RNCPM;

// This object event handler binds to v1_2 of the Connect for PHP API
use \RightNow\Connect\v1_2 as RNCPHP;

require_once '/cgi-bin/<interface>.cfg/scripts/include/src/rnwintf.phph';