首页 > 其他 > 详细

Event Handler Content must support at least one class.

时间:2021-07-28 18:26:54      阅读:25      评论:0      收藏:0      [点我收藏+]

这个问题出现在 oracle CPM 要绑定在自定义对象上的操作引起的

  官方文档 :https://cx.rightnow.com/app/answers/detail/a_id/6971/kw/Event%20Handler%20Content%20must%20support%20at%20least%20one%20class.%20

/*
* CPMObjectEventHandler: demo
* Package: OracleServiceCloud
* Objects: Contact, CO\TestCustomObject   PS:如果只是操作oracle 自身的  Contact直接写,但是操作定义的要加上 CO\
* Actions: Create, Update
* Version: 1.3
*/

- the header is required, even though it is commented
- it will be read and used by the runtime
- it contains information on the objects and actions supported by the script
- the CPMObjectEventHandler name must match the class name and the test harness class (see examples below)

2. The implementation

- contains the required custom business logic to manipulate objects that are passed in at runtime
- the apply() method does most of the work
- the API version must match the one specified in the header
- the class name must match the name specified in the header
- the apply() function has 4 parameters: $run_mode (indicates if the script is running in a test harness or in production), $action (the event that triggered the execution - create, update or destroy), $object - the object executed on (e.g. Incident), $n_cycles (the number of execution loops the script has entered)
- sample:

use \RightNow\Connect\v1_3 as RNCPHP;
use \RightNow\CPM\v1 as RNCPM;
 
class demo implements RNCPM\ObjectEventHandler {
    
public static function apply($run_mode, $action, $obj, $n_cycles){ 
    switch($action) {
    case RNCPM\ActionCreate:
        $verb="created";
        break;
    case RNCPM\ActionUpdate:
        $verb="updated";
        break;
    }
}
}

 

Event Handler Content must support at least one class.

原文:https://www.cnblogs.com/yezi1116/p/15071519.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!