Hi All,
I am trying to call Library files from CPM by following the http://cxdeveloper.com/article/cpms-custom-process-management answer from cxdeveloper forum.
I am getting below error.
Object Event Handler Inc_Update\Inc_Update does not define class Inc_Update!
Here Inc_Update is my file/class name.
Please help me with this approach. Also I am trying to call the Controller from CPM, but I am not sure the syntax. Please share that.
Thanks in advance.
~ S.Saravanan
Answer
Sarvanan - Can you paste the code here removing any unwarranted info..
~Suresh
Average Rating:
100% (+1/-0)
|
Sign in to rate this
Hi Suresh,
Please find the attached codes.zip file.
Average Rating:
100% (+1/-0)
|
Sign in to rate this
Saravan - I think you missed this line in CPM
use \Custom\Libraries\CPM\v1 as CPMHandler;
Be the first to rate this
|
Sign in to rate this
For your case, its "use \Custom\Libraries\CPM\V3 as CPMHandler;"
Be the first to rate this
|
Sign in to rate this
Suresh - I have added the line of code as per your suggestion, but still am getting the same error.
Object Event Handler Inc_Update\Inc_Update does not define class Inc_Update!
Here Inc_Update is my file/class name.
Average Rating:
100% (+1/-0)
|
Sign in to rate this
can u try my way.......
<?
/*
* CPMObjectEventHandler: XXXXXXXX
* Package: RN
* Objects: Incident
* Actions: Create,Update
* Version: 1.2
* Purpose:
*/
use \RightNow\Connect\v1_2 as RNCPHP;
use \RightNow\CPM\v1 as RNCPM;
class xxxxx implements RNCPM\ObjectEventHandler {
public static function apply($run_mode, $action, $obj, $n_cycles) {
require_once("cp/customer/development/libraries/xxxx.php");
}
}
In the library file
<?
// $run_mode, $action, $obj, $n_cycles
use \RightNow\Connect\v1_2 as RNCPHP;
$o_id = $obj->ID;
..............etc
~Suresh
Be the first to rate this
|
Sign in to rate this
Hi Suresh,
I tried as you mentioned, The library file is called successfully.
Now am getting the below error (error in library file)
---------------------------
Test Error
---------------------------
Fatal PHP error on line 13 of /cgi-bin/mysite.cfg/scripts/cp/customer/development/libraries/CPM/V3/Inc_update.php:
syntax error, unexpected '$incident' (T_VARIABLE), expecting function (T_FUNCTION)
---------------------------
OK
---------------------------
After I have added the below function line in library file, error is not coming.
Please let me know how to call this library function.
Thanks,
~ S.Saravanan
Be the first to rate this
|
Sign in to rate this
Hi Saravanan,
To call a static function from libraries file in CPM, you can refer the below code -
.......
const DEV_MODE = true;
define('APPPATH', DEV_MODE ? __DIR__ . "/scripts/cp/customer/development/" : __DIR__ . "/scripts/cp/generated/production/optimized/");
require_once APPPATH . "libraries/CPM/V3/Inc_update.php";
use \RightNow\CPM\v1 as RNCPM;
class xxxxx implements RNCPM\ObjectEventHandler
{
public static function apply($runMode, $action, $incident, $cycles)
{
CPM\V3\Inc_update::UpdateInc($runMode, $action, $incident, $cycles);
}
}
......
Hope this helps.
Thanks,
Geetha
Average Rating:
100% (+1/-0)
|
Sign in to rate this