Skip to Content
0
Former Member
May 11, 2018 at 02:14 PM

Can't Create Notes for Account using CAS

103 Views Last edit May 13, 2018 at 11:19 AM 2 rev

Hi,

Good day!

I'm trying to create an action wherein I want to copy the Notes from a Visit to the Notes of an Account. My code for the OnSave of Visit extension is below:

var qCustomer = Customer.QueryByIdentification;
var selCustomer = qCustomer.CreateSelectionParams();
selCustomer.Add(qCustomer.InternalID,"I","EQ", vPartyID);
var tCustomer = qCustomer.Execute(selCustomer);
var sCustomer = tCustomer.GetFirst();
//get text from visit text collection
var vTextCollection = this.TextCollection.Text.GetFirst();
var vText = vTextCollection.TextContent.FormattedText.content;
//create new text note for customer
var newCollection = sCustomer.TextCollection.Create();
elCText.TypeCode.content = "10034";
var newContent = sCustomer.TextCollection.Text.Create(elCText);
elCTextContent.FormattedText.content = vText;
newContent.TextContent.Create(elCTextContent);

On debug mode, I don't encounter any error but I get a report incident error once the lines above are executed.

What might be missing for the above?

Thanks in Advance!

Marc Hirang