Value Entry Table - Adding Customer Name

wangjanymwangjanym Member Posts: 21
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.

Thanks Millions.

Answers

  • ara3nara3n Member Posts: 9,256
    edited 2008-08-12
    Hello
    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.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • garakgarak Member Posts: 3,263
    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
    Do you make it right, it works too!
  • garakgarak Member Posts: 3,263
    sometimes i'm to slow :-(
    Do you make it right, it works too!
  • wangjanymwangjanym Member Posts: 21
    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.

    Thanks,
  • wangjanymwangjanym Member Posts: 21
    By the way, is flowfield make value entry table slow????????? We look at those table a lot....
  • DenSterDenSter Member Posts: 8,305
    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.
  • garakgarak Member Posts: 3,263
    so, you have to ways:
    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.
    Do you make it right, it works too!
  • wangjanymwangjanym Member Posts: 21
    Thanks Million guys.....

    Really appreciated all your help..
  • garakgarak Member Posts: 3,263
    Please write [solved] infront of the subject in your first post.
    Thanks
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    edited 2008-08-12
    wangjanym wrote:
    my boss want it that way.

    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.
  • garakgarak Member Posts: 3,263
    right savatage, like in form, for example 255
    Do you make it right, it works too!
  • SavatageSavatage Member Posts: 7,142
    I added some code to the post above (hence the edit)

    My payment journal uses this too.
Sign In or Register to comment.