AR invoice optional field setup auto

SUGGESTED

 Currently trying to insert a AR invoice detail line by line transaction and the optional field is set as auto insert under the AR/Setup optional field.

 Problem: Detail lines are inserted under the AR invoice without the optional field.

 Source code:

ARINVOICE1detail1.RecordClear();
temp = ARINVOICE1detail1.Exists;
ARINVOICE1detail1.RecordCreate(0);
ARINVOICE1detail1.Fields.FieldByName("PROCESSCMD").SetValue(0, false);
ARINVOICE1detail1.Process();
ARINVOICE1detail1.Fields.FieldByName("IDACCTREV").SetValue(IDACCTREV1, false);
ARINVOICE1detail1.Fields.FieldByName("AMTEXTN").SetValue(AMTEXTN, false);
ARINVOICE1detail1.Fields.FieldByName("CNTLINE").SetValue(0, false);
ARINVOICE1detail1.Read(false);
temp = ARINVOICE1detail1.Exists;
ARINVOICE1detail1.Insert();

Can any one help to advice on this code.

  • 0
    SUGGESTED

    Don't do the .Read before the last Insert and make sure that you haven't changed the .Order of any of the views.  If you have, make sure that they are back to 0 before saving.

    For AR invoice details - pseudo code:

    RecordClear

    set CNTLINE (optional)

    RecordGenerate false

    Process

    Set Field Values (idacctrev, amtextn, etc)

    Insert

    capture new row CNTLINE for use with creating next line