Shipping Agent Service Code not populating..

yuppicideyuppicide Member Posts: 410
edited 2009-09-10 in Navision Attain
Navision 3.10

Short version: "Shipping Agent Service Code" is entered on Customer Cards, but does not show up on Sales Orders. We have to enter it each time.

When entering new customers in Navision on the Customer Card we have a few fields we fill in reference to shipping.

On the main Customer Card under the General tab we fill in "Shipping Agent Code" for example "UPS" and "Shipping Agent Service Code" which for example is "GROUND". We also fill this in on the Ship To Address screen in addition there's a third one that says "Shipment Method Code" which in this example is "Package".

When I enter a Sales Order it is supposed to populate the three fields on the Shipping tab, but "Shipping Agent Service Code" is blank. Any ideas where to look and try to find this error? I can use a drop down box to select Ground each time, but I shouldn't have to.

Comments

  • matttraxmatttrax Member Posts: 2,309
    Look at the Sales Header table and find the OnValidate trigger for "Sell-to Customer No."
  • yuppicideyuppicide Member Posts: 410
    Thanks. I think I've found the error, but want to know what you think before I make any changes.

    I've looked in the Sales Header. It seems to have information I need.

    I see all the Fields in there.. Shipping Agent Code, Shipment Method Code, and Shipping Agent Service.

    Shipping Agent Service Code is what does not populate. I think in it's properties lies my answer.

    For TableRelation it says"
    "Shipping Agent Services".Code WHERE (Shipping Agent Code = FIELD(Shipping Agent Code))
    

    That should be changed to "Shipping Agent Service Code" I think.
  • matttraxmatttrax Member Posts: 2,309
    I'm afraid not. TableRelation means that the value that is entered in that field must exist in the table specified in that property.

    You'll need to examine the code behind the OnValidate trigger for Sell-to Customer (or Ship-to Customer, whatever field you are entering when you want it to fill in).

    If you are scared of making changes you should really think about setting up a development environment. Making changes directly to a production system is a big no-no. That way you can mess things up and you won't hurt anything.
  • SavatageSavatage Member Posts: 7,142
    Are you using E-ship? then don't forget to fill.."E-Ship Agent Service"
  • yuppicideyuppicide Member Posts: 410
    Thanks. I'll look again tomorrow. I did look for OnValidate, but did not see anything. I went into properties of Sell-To Customer No as originally said, and a few others, but was unable to locate anything. Will look again tomorrow.

    We were going to setup a development environment. Originally our Navision partner was going to set one up for us. Now, you and I both know it's nothing to set one up and use. But getting approval to do things is often hard because the owners aren't tech-savvy, nor are they in the office often. Our Operations Manager runs the place, but she likes approval of the owners for a lot of things. None of them are open to change that easily especially if they don't know what it is. Sometimes it's hard to explain to them and convince them that it will make mine (and others) jobs easier on a daily basis.
    matttrax wrote:
    I'm afraid not. TableRelation means that the value that is entered in that field must exist in the table specified in that property.

    You'll need to examine the code behind the OnValidate trigger for Sell-to Customer (or Ship-to Customer, whatever field you are entering when you want it to fill in).

    If you are scared of making changes you should really think about setting up a development environment. Making changes directly to a production system is a big no-no. That way you can mess things up and you won't hurt anything.
  • yuppicideyuppicide Member Posts: 410
    Nope. You helped me awhile ago because I had no clue what E-Ship even was. lol. We've never used it and never will I doubt.
    Savatage wrote:
    Are you using E-ship? then don't forget to fill.."E-Ship Agent Service"
  • yuppicideyuppicide Member Posts: 410
    Okay. I went into my Sales Header. I looked at the properties. There is no OnValidate for the field I want to automatically populate. I also looked under one of the fields that does work properly and there is no OnValidate either.
  • SavatageSavatage Member Posts: 7,142
    yuppicide wrote:
    Okay. I went into my Sales Header. I looked at the properties. There is no OnValidate for the field I want to automatically populate. I also looked under one of the fields that does work properly and there is no OnValidate either.

    if should happen onValidate of the customer# & also the ship-to code.
    on the table not the form
  • matttraxmatttrax Member Posts: 2,309
    There is no OnValidate property. You have to go to that field in table designer and use F9 to view the code behind that field.

    If you do not have access to the code you will need to get your NAV Partner to perform the modification for you.
  • yuppicideyuppicide Member Posts: 410
    I see. What I was doing was clicking on what I need and then going to View -> Properties.

    Yeah, I don't have access to view C/AL Code of tables, so this modification won't be doable.
    matttrax wrote:
    There is no OnValidate property. You have to go to that field in table designer and use F9 to view the code behind that field.

    If you do not have access to the code you will need to get your NAV Partner to perform the modification for you.
  • SavatageSavatage Member Posts: 7,142
    I See In My Sales Header Code:
    Sell-to Customer No. - OnValidate()
    "Shipping Agent Service Code" := Cust."Shipping Agent Service Code";
    
    Shipping Agent Code - OnValidate()
    TESTFIELD(Status,Status::Open);
    IF "Shipping Agent Code" <> xRec."Shipping Agent Code" THEN BEGIN
      "Shipping Agent Service Code" := '';
    
    Shipping Agent Service Code - OnValidate()
    TESTFIELD(Status,Status::Open);
    IF ("Shipping Agent Code" <> '') AND
       ("Shipping Agent Service Code" <> '')
    THEN
      IF ShippingAgentService.GET("Shipping Agent Code","Shipping Agent Service Code") THEN
        "Shipping Time" := ShippingAgentService."Shipping Time"
    ELSE
      EVALUATE("Shipping Time",'<>');
    
    UpdateSalesLines(FIELDCAPTION("Shipping Agent Service Code"),CurrFieldNo<>0);
    

    I don't see how base nav would not fill that field for you..did it EVER work for you? Has some mod been done?

    Please verify that in the customer card drill into Shipping Agent Code From there click on the Shipping agents->shipping agent services - I assume Gound is there
  • yuppicideyuppicide Member Posts: 410
    Savatage wrote:
    I See In My Sales Header Code:

    My license does not permit viewing C/AL Code on Tables. I can go into my Sales Order report designer, and then where it says Sales Header, I can click View C/AL Code. In there I have the following code in OnAfterGetRecord:
    ShipAgtSvcCode.SETFILTER(Code,"Sales Header"."Shipping Agent Service Code");
    IF ShipAgtSvcCode.FIND('-') THEN
      Desc := ShipAgtSvcCode.Description;
    

    I don't think that's where you want me to be as per previous message in this thread I was told to go into Sales Header table, which my license does not permit me to view C/AL Code from there.
    I don't see how base nav would not fill that field for you..did it EVER work for you? Has some mod been done?

    Far as I know it's never worked in the 3+ years I've been here. The other lady has been here since the day we've had Navision (2002 maybe?) and she says it's never worked.
    Please verify that in the customer card drill into Shipping Agent Code From there click on the Shipping agents->shipping agent services - I assume Gound is there

    They're all in there.. Ground, Ground Collect, Third Party, etc, etc.
  • jversusjjversusj Member Posts: 489
    yuppicide,
    you are correct - you do not want to be in the report code, that isn't related to your current issue.

    there is a way to see the code in your table without a dev license, provided you have access to Code Coverage. Can you do the following:
    click Tools > Debugger > Code Coverage. (not sure if it is in your version)

    if so, you may be able to run code coverage, which gets you indirect look at the underlying code. i used this for years before we had a developer license in house.

    then do the following:
    open a sales order form, insert a new record (F3).
    bring up code coverage. Press Start button.
    return to sales order form. enter sell-to customer no. for customer you know has service defined.
    navigate back to code coverage, press stop button. you should see a list of objects in the code coverage form. click on the sales header TABLE and press the Code button. this will open a form showing all the code in the sales header table. search (Control +F) the form for the field you are looking for (or search for the onvalidate triggers mentioned above).

    you should be able to see where/if that field is being defined. hope this helps you!
    kind of fell into this...
  • yuppicideyuppicide Member Posts: 410
    Great tip! At least I can view it and verify the information is there.
    Shipping Agent Service Code - OnValidate()
      TESTFIELD(Status,Status::Open);
      IF ("Shipping Agent Code" <> '') AND
         ("Shipping Agent Service Code" <> '')
      THEN
        IF ShippingAgentService.GET("Shipping Agent Code","Shipping Agent Service Code") THEN
          "Shipping Time" := ShippingAgentService."Shipping Time"
      ELSE
        EVALUATE("Shipping Time",'<>');
      
      UpdateSalesLines(FIELDCAPTION("Shipping Agent Service Code"),CurrFieldNo<>0);
    

    Same stuff Savatage displayed.

    .. that was copied from that page.
    jversusj wrote:
    yuppicide,
    you are correct - you do not want to be in the report code, that isn't related to your current issue.

    there is a way to see the code in your table without a dev license, provided you have access to Code Coverage. Can you do the following:
    click Tools > Debugger > Code Coverage. (not sure if it is in your version)

    if so, you may be able to run code coverage, which gets you indirect look at the underlying code. i used this for years before we had a developer license in house.

    then do the following:
    open a sales order form, insert a new record (F3).
    bring up code coverage. Press Start button.
    return to sales order form. enter sell-to customer no. for customer you know has service defined.
    navigate back to code coverage, press stop button. you should see a list of objects in the code coverage form. click on the sales header TABLE and press the Code button. this will open a form showing all the code in the sales header table. search (Control +F) the form for the field you are looking for (or search for the onvalidate triggers mentioned above).

    you should be able to see where/if that field is being defined. hope this helps you!
  • SavatageSavatage Member Posts: 7,142
    RUN the code coverage when you enter the customer #.

    look for this under Sell-to Customer No. - OnValidate()
    "Shipping Agent Service Code" := Cust."Shipping Agent Service Code";
    
  • yuppicideyuppicide Member Posts: 410
    I do see that. I've also looked under the Ship-to Code section and do not see it there.

    When there's no Ship-to Address (just the default one on the customer card) it needs to fill in.. but it also needs to validate when I do select Ship-to Address. A few customers have different ship methods based on location.. if I ship to one store in Hawaii or Puerto Rico they use FedEx Third Party. If it's in United States they use FedEx Ground Collect.
    Savatage wrote:
    RUN the code coverage when you enter the customer #.

    look for this under Sell-to Customer No. - OnValidate()
    "Shipping Agent Service Code" := Cust."Shipping Agent Service Code";
    
  • jversusjjversusj Member Posts: 489
    yuppicide,
    since your license does not allow you to modify code behind tables, you now need to turn to your VAR and request this modification. you say that you see the code in the onvalidate of the sell-to customer, but is that code being called? Code that is called is often displayed in black text, while code that was not called in displayed in red on the code coverage code form. i suggest you search all of the sales header table code for the field you think needs to be auto defined and take note of all the places it is impacted. it may be true that 1 piece of code is correctly populating your field, but another piece of code is errantly wiping it out. by doing this research, you will come to better understand NAV and with that understanding, be able to more defined requests from your VAR, resulting in lower development costs.

    i found that by going through code coverage and reading what was happening, i was able to provide detailed instructions to my reseller when i needed things tweaked. i could see, for example, if something was missing in the Ship-to Code OnValidate and specifically tell him to add something there. it reduced the billable hours as time passed (well, this is a very basic example, but you get the point).
    kind of fell into this...
  • yuppicideyuppicide Member Posts: 410
    Thanks for all the help. I've contacted our partner and will get a quote on how much to fix it.

    Edited:

    They found the code where it gets ship-to information and for some reason it fills in the two, but skips the third one. They're going to get back to me on it.
  • Mucho21Mucho21 Member Posts: 1
    Great tip! At least I can view it and verify the information is there. Many can benefit with it thanks a lot for this...

    Regards

    Albert
    _______
    Pret immobilier
  • yuppicideyuppicide Member Posts: 410
    Our Navision partner couldn't get this to work on their end either, so I received a time estimate and quote on how much to do the work. Now I just need to get the signature from our Operations Manager to go ahead with it.

    One of the things I am using as leverage in getting this done is to say that I've already gotten a lot of modifications done on my own. That saved us more than the cost of this shipping modification. Also, the one report I was helped to create saves us at least 3 to 4 hours work every week! So, hopefully that will push them to get the modification done.
Sign In or Register to comment.