CPM code invoke twice
Content
Hi Gurus,
We have requirement like, whenever Contact is updated need to set one custom field value and send a notification to an agent. I have deployed the below CPM code on Contact Update.
My issue is, I have received two email. Please provide your inputs.
Code Snippet
<?php /** * CPMObjectEventHandler: Email_Test * Package: RN * Objects: Contact * Actions: Create, Update * Version: 1.2 */ use \RightNow\Connect\v1_2 as RNCPHP; use \RightNow\CPM\v1 as RNCPM; class Email_Test implements RNCPM\ObjectEventHandler { public static function apply($runMode, $action, $contact, $cycles) { $cid = $contact->ID; if($cid !=null && $cid!="" ){ $first_name = $contact->Name->First ; $last_name = $contact->Name->Last ; // Our Business Logic - Setting values $contact->CustomFields->c->customer_name = $first_name. " ".$last_name ; // Email Notification $Email = "[email protected]";
1