• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
风吹叶子吖
博客园    首页    新随笔    联系   管理    订阅  订阅

Event Handler Content must support at least one class.

这个问题出现在 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;
    }
}
}

 

posted @ 2021-07-28 17:13  夏夜~  阅读(46)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3