Different Salesperson Code on Ship-To's

SavatageSavatage Member Posts: 7,142
edited 2005-05-25 in Navision Attain
We have a few accounts that have 1 home office & 50 ship-to's.

We had them all setup as seperate accounts but to make EDI a little easier I changed them to all ship-to codes.

Now not every store has the same salesperson. I added a field to the Ship-to Address table called obviously "Ship-to Salesperson Code"

How can I get the salesperson code in the sales header of an order automatically change to the proper code.

the salesorder pulls the salesperson code from the customer card. I would need it then to see if a Ship-To code has been entered, and if so change it to the code on the ship-to address card.

not every customer has a ship-to address code so it's a left-outter join type of situation.

I figured on the

Ship-To Code - OnValidate()
"Salesperson Code" := "Ship-To Address"."Ship-To Salesperson Code";

feedback needed thanks!

Comments

  • kinekine Member Posts: 12,562
    Ship-To Code - OnValidate() 
    if "Ship-To Code" <> '' then begin //ship-to code is entered
      ShipToAddr.GET("Ship-To Code");
      VALIDATE("Salesperson Code",ShipToAddr."Ship-To Salesperson Code");
    end else begin  //ship-to code is empty - take code from customer
      Customers.GET("Sell-To Code");
      VALIDATE("Salesperson Code",Customers."Salesperson Code");
    end;
    
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • DenSterDenSter Member Posts: 8,307
    Don't forget to add code to the Sell-to Customer code validation to leave the salesperson field alone if there is a ship-to.

    What I'd do is create a new function on the Sales header called SetSalesperson or something, and add a call to this function to the sell-to customer code validation and the ship-to validation. That way you only have this code in one place and the salesperson should always be consistent.

    Let me know if you need me to give you an idea of how to do this, and I'll post some code.
Sign In or Register to comment.