Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

TextCollection - new standard BO note using ABSL

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

replied

Hello Michal,

I suggest to provide the TypeCode with the Create:

var tc = this.TextCollection.Create();

var txtData : elementsof Opportunity.TextCollection.Text;

txtData.TypeCode.content = "1002";

tc.Text.Create( txtData );

HTH,

    Horst

1 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question