$ 0 0 Topic by Shreyas PandhariVersionFeb 13, Feb 14Code Block<? /* * CPMObjectEventHandler: soap_on_incident_create * Package: RN * Objects: Incident * Actions: Create * Version: 1.2 */ use \RightNow\Connect\v1_2 as RNCPHP; use \RightNow\CPM\v1 as RNCPM; class soap_on_incident_create implements RNCPM\ObjectEventHandler { public static function apply( $run_mode, $action, $obj, $n_cycles) { if (RNCPM\ActionCreate == $action) { if (strpos($obj->Subject, "lawyer") !== false) // if "lawyer" appears at any position in subject string { include_once('/cgi-bin/xyz.cfg/scripts/cp/customer/development/libraries/nusoap.php'); include_once('/cgi-bin/xyz.cfg/scripts/cp/customer/development/libraries/class.wsdlcache.php'); $wsdl="http://ws.cdyne.com/delayedstockquote/delayedstockquote.asmx?wsdl"; $client=new nusoap_client($wsdl, 'wsdl'); $client->soap_defencoding = 'UTF-8'; $client->debug_flag = false; $lk = "7058"; $result=$client->call('GetQuote', array('StockSymbol' => $obj->Subject, 'LicenseKey' => $lk)); $soapError = $client->getError(); if (!empty($soapError)) { $errorMessage = 'SOAP method invocation failed:'.$soapError; throw new Exception($errorMessage); } else { $subjectLine = "I want a lawyer via Custom Process2"; $obj->Subject = $subjectLine.$result["GetQuoteResult"]["LastTradeDateTime"]; $obj->save(); } } } return; } }