Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- /*
- * CPMObjectEventHandler: challenge66
- * Package: OracleServiceCloud
- * Objects: Contact
- * Actions: Create
- * Version: 1.3
- */
- use \RightNow\Connect\v1_3 as RNCPHP;
- use \RightNow\CPM\v1 as RNCPM;
- class challenge66 implements RNCPM\ObjectEventHandler {
- public static function apply($run_mode, $action, $obj, $n_cycles){
- try{
- debug("Creating incident".$obj->ID);
- $obj->Subject = " CPM " .$obj->ReferenceNumber;
- $incident->save(RNCPHP\RNObject::SuppressAll);
- debug("Incident saved");
- }
- catch(Exception $e){
- debug($e->getMessage());
- }
- }
- }
- class challenge66_TestHarness implements RNCPM\ObjectEventHandler_TestHarness {
- static $inc_invented = NULL;
- public static function setup(){
- return;
- }
- public static function fetchObject($action, $object_type){
- $incident=$object_type::first('ID > 0');
- echo "Fetched Contact ID ".$incident->ID;
- return($incident);
- }
- public static function validate($action, $object){
- return true;
- }
- public static function cleanup(){
- return;
- }
- }
- function debug($string){
- $fp = fopen("/tmp/vlad" . date("Ymd") .".txt", "a+");
- fwrite($fp, date("Y-m-d H:i:s") . " " . $string . "\n");
- fclose($fp);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement