cancel
Showing results for 
Search instead for 
Did you mean: 

TextCollection - new standard BO note using ABSL

michal_pospil
Participant
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert

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

michal_pospil
Participant
0 Kudos

You are right! Thank you Horst!

BTW: I had to change the TypeCode to 10001.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Michal,

Yes, the current suported TypeCode is 10001.

With the next release we will support

  • 10001
  • 10006
  • 10011
  • 10025
  • 10071

Bye,

   Horst

mischaimbiscuso
Explorer
0 Kudos

Hi one question. Could you send an example with ItemTextCollection? (CustomerInvoiceRequest.Item.ItemTextCollection).

I have to copy the content of another TexCollection into this ItemTextCollection, but cannot find a solution for this task.

Many thanks, Mischa

Answers (1)

Answers (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Mischa,

I am no longer with this department (for a long time already 😉 ). but I suggest to replace the "Opportunity.TextCollection" with "CustomerInvoiceRequest.Item.ItemTextCollection" and give it a try.

All the best,
. Horst