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

Thread Duplicacy on commit

Received Response
16
Views
1
Comments
edited Jun 7, 2019 11:45AM in General Technical Discussions 1 comment

Summary

Connect PHP API commit causes Thread Duplicacy

Content

Hi,

When I run the following code, the Thread is written twice to the incident. Not sure why.

But, when I remove the RNCPHP\ConnectAPI::commit() statement, the thread is written once once.

Anyone has any idea why this is happening? How to avoid this without removing the commit statement.

Appreciate your help.

Thanks,
Geetha

Version

19A

Code Snippet

$inc = RNCPHP\Incident::fetch(101338);
$thread_count = count($inc->Threads);
$inc->Threads[$thread_count] = new RNCPHP\Thread();
$inc->Threads[$thread_count]->EntryType = new RNCPHP\NamedIDOptList();
$inc->Threads[$thread_count]->EntryType->ID = 3;
$inc->Threads[$thread_count]->ContentType = new RNCPHP\NamedIDOptList();
$inc->Threads[$thread_count]->ContentType->LookupName = "text/html";
$inc->Threads[$thread_count]->Text = "<p>Test Thread Text</p>";
$inc->Threads[$thread_count]->Contact = RNCPHP\Contact::fetch(1);
$inc->save();
RNCPHP\ConnectAPI::commit();

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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