Hi, All. First time posting here and I'd like to know how to modify the system to populate customer name automatically whenever sales order get posted. Currently running Nav 4.0 with SP1.
why you need the field "customer Name" :?: you can find out which customer it is with the field "Source No." (Source Type = Customer). this field has an table relation to tabel customer
Yeah, I understand why you guys ask me that question. However, my boss want it that way. I know what I can look up the source no. to find the name and it makes database big. Well, it is kinda stupid but I want to know how and if you guys can give the code to make it happens that will be very nice.
The flowfield itself won't make posting slow, but opening a form with a flowfield can potentially cause massive performance problems, especially on something like the value entry table, where you have thousands of records on the list form.
Not really a good answer to why you need the name there.
What's his reason?
How about adding a box at the bottom of the form that get's the customer name when you click on a line. There are many journal forms that do this already
All you have to do is:
-Add a Variable type Text size 65 called IdentifySource
-add a textbox at the bottom of form 5802 (I assume you use that one)
with sourceexp = IdentifySource
then add some thing like this to the form's code ( i guess i could have used a case statement - but anyway It's just the basic idea.
Now whatever line you click on it will show you the name at the bottom of the form without any changes to codeunits or tables.
OnAfterGetCurrRecord()
CLEAR(IdentifySource);
IF "Source Type" = "Source Type"::Customer THEN BEGIN
IF Customer.GET("Source No.")
THEN IdentifySource := Customer.Name;
END;
IF "Source Type" = "Source Type"::Item THEN BEGIN
IF Item.GET("Source No.")
THEN IdentifySource := Item.Description+' '+Item."Description 2";
END;
IF "Source Type" = "Source Type"::Vendor THEN BEGIN
IF Vendor.GET("Source No.")
THEN IdentifySource := Vendor.Name;
END;
Note for the textbox at the bottom of the form don't forget to set the glues to Bottom & Left.
Answers
Could you tell us why you want the customer name in that table?
If it's for report you don't need to add it to the table.
If you want to see if on a form, you can add code the the form to grab it from customer name.
If you real must have it, then I would add it as a flowfield.
THe source No is the customer No. and souce type is customer.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
Thanks,
RIS Plus, LLC
first when a value entry is created (for example in Cu22) you can also store the Customer name in a new field.
second way: use a flowfield. but note, if you view many records in your list, the system must ever calculate this field.
Really appreciated all your help..
Thanks
Not really a good answer to why you need the name there.
What's his reason?
How about adding a box at the bottom of the form that get's the customer name when you click on a line. There are many journal forms that do this already
All you have to do is:
-Add a Variable type Text size 65 called IdentifySource
-add a textbox at the bottom of form 5802 (I assume you use that one)
with sourceexp = IdentifySource
then add some thing like this to the form's code ( i guess i could have used a case statement - but anyway It's just the basic idea.
Now whatever line you click on it will show you the name at the bottom of the form without any changes to codeunits or tables.
Note for the textbox at the bottom of the form don't forget to set the glues to Bottom & Left.
http://www.BiloBeauty.com
http://www.autismspeaks.org
My payment journal uses this too.
http://www.BiloBeauty.com
http://www.autismspeaks.org