Options

No. Series on Ship-To Address Table

thaugthaug Member Posts: 106
I'm trying to implement an automatic/default no. series on the Ship-To Address table. I've got all of the pieces set up in code, but I'm having a problem with it that I think is related to the form link.

On the customer card, when I select Ship-To Addresses, I hit F3 to create a new record and get the following error: "Code must be filled in. Please enter a value." If I click on the AssistEdit button and choose the no. series, it creates the new record as expected. So it works, I'm just looking for a way to implement this so that it works by the normal process of inserting a new record by hitting F3.

Classic client.
There is no data, only bool!

Answers

  • Options
    Alex_ChowAlex_Chow Member Posts: 5,063
    Not know what your code is or what additional fields you created on the Ship-to table, I can only assume your code is wrong.

    Post what code you have written so far.
  • Options
    thaugthaug Member Posts: 106
    In table 222, Ship-To Address:
    OnInsert()
    IF Code = '' THEN BEGIN
      SalesSetup.GET;
      SalesSetup.TESTFIELD("Cust. Ship-To Nos.");
      NoSeriesMgt.InitSeries(SalesSetup."Cust. Ship-To Nos.",xRec."No. Series",0D,Code,"No. Series");
    END;
    

    Code field - OnValidate()
    IF Code <> xRec.Code THEN BEGIN
      SalesSetup.GET;
      NoSeriesMgt.TestManual(SalesSetup."Cust. Ship-To Nos.");
      "No. Series" := '';
    END;
    

    Function AssistEdit
    WITH Cust DO BEGIN
      Cust := Rec;
      SalesSetup.GET;
      SalesSetup.TESTFIELD("Cust. Ship-To Nos.");
      IF NoSeriesMgt.SelectSeries(SalesSetup."Cust. Ship-To Nos.",OldCust."No. Series","No. Series") THEN BEGIN
        NoSeriesMgt.SetSeries(Code);
        Rec := Cust;
        EXIT(TRUE);
      END;
    END;
    
    Cust and OldCust variables = T222, Ship-To Address

    On Form 300, Ship-To Address
    OnAssistEdit
    IF AssistEdit(xRec) THEN
      CurrForm.UPDATE;
    

    New field in Sales & Receivalbe Setup table
    SalesSetup."Cust. Ship-To Nos."

    I created the necessary no. series. Ship-To Address form is called from the Customer Card form Function menu with
    RunFormLink = Customer No.=FIELD(No.)
    There is no data, only bool!
  • Options
    BernardJBernardJ Member Posts: 57
    This is related to the 'not blank' property of the Code table field.
    Because this property is set on a primary key field, this will be validated as soon as you insert a new record (before the No series-code is given a chance to fill this field)
  • Options
    thaugthaug Member Posts: 106
    Thank you. That worked.
    There is no data, only bool!
Sign In or Register to comment.