Greetings all!
I am new to the forum and Navision so please forgive my ignorance.
I need to put the phone number from the Customer table on the Sales Order form...
The Sales Order form points to the Sales Header table however.
How do I display the Customer.Phone No. in a textbox where Customer.No. = Sales Header.Sell-to Customer No. ? Does anyone have a code sample and where to place it? Thank you!
gadzilla1
Answers
http://www.BiloBeauty.com
http://www.autismspeaks.org
I'm beginning Navision - my background is VB.NET.
I'm hoping this is a simple problem, any suggestions? Thank you.
then, using code define the value of that variable. something like:
Customer.RESET;
Customer.GET("Sell to Customer No.");
CustPhone := Customer."Phone No.";
you'd want to make sure you put the variable definition in the correct trigger so that as you moved between orders, it would be getting updated.
this assumes you just want to see the phone number on the sales order form and that you do not want the actual phone number data written to the sales header (muksha's response).
i cannot modify forms, but i did something similar with a report request form and it worked okay.
if you look at the code on the table there is a section called
Sell-to Customer No. - OnValidate()
If you scroll down enuf you will see where Customer Info gets transfered to the Sales Header.
Now if you add in.. ( See Red )
GetCust("Sell-to Customer No.");
Cust.TESTFIELD(Blocked,FALSE);
GLSetup.GET;
IF GLSetup."VAT in Use" THEN
Cust.TESTFIELD("Gen. Bus. Posting Group");
"Sell-to Customer Template Code" := '';
"Sell-to Customer Name" := Cust.Name;
"Sell-to Customer Name 2" := Cust."Name 2";
"Sell-to Address" := Cust.Address;
"Sell-to Address 2" := Cust."Address 2";
"Phone No." := Cust."Phone No."; //note your change!
"Sell-to City" := Cust.City;
"Sell-to ZIP Code" := Cust."ZIP Code";
"Sell-to State" := Cust.State;
"Sell-to Country Code" := Cust."Country Code";
"Sell-to Contact" := Cust.Contact;
etc, etc
Now Add "Phone No." to your Sales Header Card.
*as always if you are not sure what you are doing - first do it in a test database & comment out your code - so it will be easy to be found in the future*
PS if you want the phone number to also transfer to the Sales Invoice Header - then add the field "Phone No." to the "Sales Invoice Header" using the SAME ID NUMBER - then the transfer will happen without any further code.
http://www.BiloBeauty.com
http://www.autismspeaks.org
http://www.BiloBeauty.com
http://www.autismspeaks.org
Eric Wauters
MVP - Microsoft Dynamics NAV
My blog
I was able to add the Phone Number by adding a Flowfield/Lookup to the Sales Header table...that seemed the easiest.
The only thing is that the end user requested that this phone number field be used to lookup the customer data to populate the sales order, and actually populate fields just like the Sell-To Customer No. does now for new sales orders.
Is this advisable or possible? I don't want to stir too much if this goes against the Navision grain...
Also, thanks for the tip on the Application Designer's Guide...good stuff, but for syntax there's not much else out there it seems...
when you type in a customer's name into the sell-to customer number - that it will find what you type & change it to the customer number.
What makes the lookup possible using the customers name (search name I believe) is a property called AltSearchField.
if you goto desinger of a table and click on a field & view its properties you will see it there. then click on altsearchfield, F1 then for more info.
So another solution would be to fill in the customer "search name" with their phone number and it should work.
You can create a report that copies all the phone numbers to the search name field so you don't have to manually enter them. Note - no custs can have the same number else you have a problem.
Using the Customer Table as a dataitem.
If you want to eliminate the dashes you can do that too with code.
using DELCHR
I guess it's up to your dataentry people & how they would like to hanlde it.
These are the 3 things I can come up with..
#1)Change the AltSearchField to lookup phone numbers
or #2)making a customer's number their phone number your problem would be solved. ex, 800-212-0038 would be the Cust No.
or #3)Enter The Phone # into the Search name Field
personally choice #3 is the easiest and what I would opt for. It's also easy to test. Change one customers Search Name to there Phone number and start a new order. In the Sell-to customer no now enter that phone number, hit enter.
Anyone else got suggestions?
http://www.BiloBeauty.com
http://www.autismspeaks.org
http://www.BiloBeauty.com
http://www.autismspeaks.org
I chose '#1)Change the AltSearchField to lookup phone numbers ' and it works great!
Also I will make sure to create new posts for new topics.
Have a great great day! Thanks to everyone.
8)
http://www.BiloBeauty.com
http://www.autismspeaks.org