Quantcast
Channel: Discussion Forum > Connect Data Services
Viewing all articles
Browse latest Browse all 2504

Creating additional Contact Notes in Custom Process (1 Comment)

$
0
0

Topic by kahelfrich

Content

I'm working on some custom process code to update some fields when a contact is updated, and I'm running into a snag.

Under certain circumstances, I want to add a note to the contact to detail the change in case there is a problem later.  I found some code in the help files that shows how to add a note. It seems to work fine if the contact has no existing notes.  However, if the contact has an existing note, it always fails with a message like:

Fatal PHP error on line 56 of UpdLogin/UpdLogin:

Uncaught exception 'Exception' with message 'Must be a Note' in UpdLogin/UpdLogin:56

(and a stack trace)

The code is below.  Line 56 is:

     $contact->Notes[$n_count] = new RNCPHP\Note();

So the problem seems to be that if there are already notes, the $contact->Notes array doesn't exist or something like that?  I learned that the CUSTOM fields will be null unless they were updated, but Notes is a STANDARD field, so I thought it would work.  Not so.

I also tried this, if there were previous notes, but it didn't work either.

  $n_count=count($contact->Notes);
  $n=$contact->Notes;
  $n[$n_count] = new RNCPHP\Note();
  $n[$n_count]->Text = $note_text;

Any ideas?  I can't find any reference to that error message.

Version

August 2012

Code Block


Viewing all articles
Browse latest Browse all 2504

Trending Articles