We'd love to hear from you! Provide  feedback  to earn a badge today. Take our quick survey
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Issue with Retrieving Previous value.

Received Response
10
Views
6
Comments
edited Dec 3, 2017 11:29AM in Integrations and APIs 6 comments

Content

Hi Team,

We have a custom PHP that sends out a mail when severity of an incident is changed. When we try compiling the code , we are unable to retrieve the previous value of the severity to compare it with the current severity value.

We are executing the CPM synchronously.

Error Thrown :   Line 31 : Trying to get property of a non object 

Version

Service cloud

Code Snippet

             <?
/*
 * CPMObjectEventHandler: mailonseveritychange_syn
 * Package: RN
 * Objects: Incident
 * Actions: Update
 * Version: 1.2
 */
use \RightNow\Connect\v1_2 as RNCPHP;

use \RightNow\CPM\v1 as RNCPM;

class mailonseveritychange_syn
        implements RNCPM\ObjectEventHandler
{
    public static function apply( $run_mode, $action, $incident, $cycle )
    {
        if ($cycle !== 0) return;

		
		 if (RNCPM\ActionUpdate == $action)
		 {
	  $incidentId=$incident->ID;
	  
	   $Severity = RNCPHP\ROQL::query("select severity.lookupname from incident where id=$incidentId;" )->next();
	   $SeverityLookupname=$Severity->next();
	   
	

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!