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

Custom process - how to read incoming thread

Received Response
25
Views
1
Comments
edited Jun 8, 2022 12:09PM in General Technical Discussions 1 comment

Content

Hi,

I have a business rule that says anything from a particular contact, apply an event handler that's a custom process that adds a private note to a messagethread.

My question is how would I access the thread at this point?

So let's say this contact sends an email to the CX inbox with the content "HELLO, THIS IS ME" - this will eventually appear in the messagethread. My question is how would I access this in the custom process?

Thanks

Code Snippet

<?php

/**
 * CPMObjectEventHandler: CustomerServicesDigitalEmail
 * Package: OracleServiceCloud
 * Objects: Incident
 * Actions: Create
 * Version: 1.3
 * Purpose: Minimal CPM handler for incident update
 */
use \RightNow\Connect\v1_3 as RNCPHP;
use \RightNow\CPM\v1 as RNCPM;

class CustomerServicesDigitalEmail implements RNCPM\ObjectEventHandler
{
    public static function apply($run_mode, $action, $obj, $n_cycles) 
    {
		if ($n_cycles !== 0) return;
		if ((RNCPM\ActionUpdate == $action || RNCPM\ActionCreate == $action) && ($obj->PrimaryContact->ID == 38465 || $obj->PrimaryContact->ID == 54599)) {
			try 
			{
				$obj->Threads = new RNCPHP\ThreadArray();
				$obj->Threads[0] = new RNCPHP\Thread();
				$obj->Threads[0]->EntryType = new RNCPHP\NamedIDOptList();
				$obj->Threads[0]->EntryType->ID = 1; // Used the ID here. See the Thread object for definition
				$obj->Threads[0]->ContentType = 2;
      

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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