Hello,
I am trying to fill the snadard Note field on standard Opportunity TI using ABSL beforeSave script.
If the note in opportunity is already set, the script will successfully edit the note. This is working.
this.TextCollection.Text.TextContent.GetFirst().Text.content = "new note text";
BUT if the original note on opportunity is empty, the script fails. The reason is because the TextCollection instance is not set yet. So my question is how to create new note using ABSL (standard BO). My script always fails at line 3. It says I need to set TypeCode of the note. I am able to set the TypeCode after the Create(), not before.
if(!this.TextCollection.IsSet()){ // this = Opportunity root var tc = this.TextCollection.Create(); var txt = tc.Text.Create(); // it trows error here - set TypeCode for notes txt.TypeCode.content = "10002"; var txtCont = txt.TextContent.Create(); txtCont.Text.content = "new note text"; }
Please help
Kind Regards
Michal