Advertisement
Guest User

cpm

a guest
Oct 14th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?
  2.  
  3. /*
  4. * CPMObjectEventHandler: challenge66
  5. * Package: OracleServiceCloud
  6. * Objects: Contact
  7. * Actions: Create
  8. * Version: 1.3
  9. */
  10.  
  11. use \RightNow\Connect\v1_3 as RNCPHP;
  12.  
  13. use \RightNow\CPM\v1 as RNCPM;
  14.  
  15. class challenge66 implements RNCPM\ObjectEventHandler {
  16.  
  17.  
  18. public static function apply($run_mode, $action, $obj, $n_cycles){
  19.  
  20. try{
  21. debug("Creating incident".$obj->ID);
  22. $obj->Subject = " CPM " .$obj->ReferenceNumber;
  23. $incident->save(RNCPHP\RNObject::SuppressAll);
  24. debug("Incident saved");
  25. }
  26. catch(Exception $e){
  27. debug($e->getMessage());
  28. }
  29. }
  30. }
  31.  
  32.  
  33.  
  34.  
  35. class challenge66_TestHarness implements RNCPM\ObjectEventHandler_TestHarness {
  36.  
  37. static $inc_invented = NULL;
  38.  
  39. public static function setup(){
  40.  
  41. return;
  42. }
  43.  
  44. public static function fetchObject($action, $object_type){
  45. $incident=$object_type::first('ID > 0');
  46. echo "Fetched Contact ID ".$incident->ID;
  47. return($incident);
  48. }
  49.  
  50. public static function validate($action, $object){
  51.  
  52. return true;
  53. }
  54.  
  55. public static function cleanup(){
  56.  
  57.  
  58. return;
  59. }
  60. }
  61.  
  62. function debug($string){
  63. $fp = fopen("/tmp/vlad" . date("Ymd") .".txt", "a+");
  64. fwrite($fp, date("Y-m-d H:i:s") . " " . $string . "\n");
  65. fclose($fp);
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement