mibuso.com

Microsoft Business Solutions online community
It is currently Thu Jun 20, 2013 7:06 am

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [Solved] No. Series on Ship-To Address Table
PostPosted: Wed Apr 25, 2012 6:29 pm 
Offline

Joined: Wed Apr 05, 2006 2:04 pm
Posts: 99
Location: United States
Country: United States (us)
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!


Last edited by thaug on Thu Apr 26, 2012 7:20 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: No. Series on Ship-To Address Table
PostPosted: Wed Apr 25, 2012 7:06 pm 
Offline
MVP Microsoft Dynamics NAV

Joined: Fri Jun 11, 2004 9:05 pm
Posts: 4878
Location: Los Angeles, CA
Country: United States (us)
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.

_________________
Confessions of a Dynamics NAV Consultant = my blog
AP Commerce, Inc. = where I work


Top
 Profile E-mail WWW  
 
 Post subject: Re: No. Series on Ship-To Address Table
PostPosted: Wed Apr 25, 2012 7:54 pm 
Offline

Joined: Wed Apr 05, 2006 2:04 pm
Posts: 99
Location: United States
Country: United States (us)
In table 222, Ship-To Address:
OnInsert()
Code: Select all
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()
Code: Select all
IF Code <> xRec.Code THEN BEGIN
  SalesSetup.GET;
  NoSeriesMgt.TestManual(SalesSetup."Cust. Ship-To Nos.");
  "No. Series" := '';
END;


Function AssistEdit
Code: Select all
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
Code: Select all
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!


Top
 Profile  
 
 Post subject: Re: No. Series on Ship-To Address Table
PostPosted: Wed Apr 25, 2012 10:43 pm 
Offline

Joined: Sat Jan 28, 2012 4:48 pm
Posts: 56
Country: Netherlands (nl)
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)


Top
 Profile  
 
 Post subject: Re: No. Series on Ship-To Address Table
PostPosted: Thu Apr 26, 2012 7:19 pm 
Offline

Joined: Wed Apr 05, 2006 2:04 pm
Posts: 99
Location: United States
Country: United States (us)
Thank you. That worked.

_________________
There is no data, only bool!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: King Willem IV and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: