Options

Modified OnLookup on Page causes strange results

Joe_MathisJoe_Mathis Member Posts: 173
edited 2011-01-26 in NAV Three Tier
Hello Everyone,

Using 2009R2 (6.00.32012)(NA Version).
Cronus USA, Inc.
Sorry no W1 version so I couldn't check there... :mrgreen:

Added the following code to the No. - OnLookup trigger of the Sales Order Subform page (46):
CASE Type OF 
  Type::Item : BEGIN
    IF FORM.RUNMODAL(0,Item) = ACTION::LookupOK THEN
      VALIDATE("No.",Item."No.");
  END;
  Type::"G/L Account" : BEGIN
    IF FORM.RUNMODAL(0,GlAccount) = ACTION::LookupOK THEN
      VALIDATE("No.",GlAccount."No.");
  END;
  Type::" " : BEGIN
    IF FORM.RUNMODAL(0,StandardText) = ACTION::LookupOK THEN
      VALIDATE("No.",StandardText.Code);
  END;
  Type::Resource : BEGIN
    IF FORM.RUNMODAL(0,Resource) = ACTION::LookupOK THEN
      VALIDATE("No.",Resource."No.");
  END;
  Type::"Fixed Asset" : BEGIN
    IF FORM.RUNMODAL(0,FixedAsset) = ACTION::LookupOK THEN
      VALIDATE("No.",FixedAsset."No.");
  END;
  Type::"Charge (Item)" : BEGIN
    IF FORM.RUNMODAL(0,ItemCharge) = ACTION::LookupOK THEN
      VALIDATE("No.",ItemCharge."No.");
  END;
END;

The variables for the records are the record names, just add the spaces or characters. Nothing really special about it.

This issue is from upgrading a CC customer to the RTC. Intentions are to filter the Items so that the Bill-to customer's items are the only ones that get displayed, but found the issue and am trying to troubleshoot. ](*,)

So when you run this page in the RTC (normal access to the Sales Orders, not directly running the page) a couple of things don't happen.

1. You can't use the auto complete to get the No. field entered anymore. ie Type = Resource, No. = L should validate out to LIFT, LIN = LINDA.
Instead you get a stinking red X error.
2. The drop-down doesn't work anymore, but you do get a lookup page that pops-up.

As far as CC is concerned everything works as expected.

I have tried specifying the form explicitly although only for Resources
  Type::Resource : BEGIN
    IF FORM.RUNMODAL(FORM::"Resource List",Resource) = ACTION::LookupOK THEN
      VALIDATE("No.",Resource."No.");
  END;
with no greater results.

I cannot find any related posts or anyone else mentioning any issues like this.
So... anyone else run into anything similar? Am I missing something simple?

Thanks for your ideas, I'll try them in Cronus. [-o<

Comments

  • Options
    Joe_MathisJoe_Mathis Member Posts: 173
    Ok, so #2 is a documented 'feature'... :roll:

    http://blogs.msdn.com/b/clausl/archive/2008/09/21/new-drop-down-window-in-microsoft-nav-2009-using-fields-groups.aspx

    Is there a way to create filters on field groups yet?

    Might be the solution...
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    1/ Create a new field and do it through properties instead, and then on validate just update the Type and No. fields.

    2/ Don't put code on forms/pages, put it in the table.
    David Singleton
  • Options
    Joe_MathisJoe_Mathis Member Posts: 173
    Hi David,

    1. I'll see if it's an acceptable solution. Not exactly where I was hoping to go, but it would get the job done.

    2. I put it on the page/form so I could see the differences quickly when troubleshooting/testing. :oops: Thank you for your reminder and I agree, you should keep your code and functions on the table. It's easier to maintain and a new form/page would have the same functionality on the same field (well mostly, form properties could differ). :D

    Hopefully they are working on letting the dropdown lookups use the custom code eventually, seems a shame that it can't.

    Any thoughts on reason the autocomplete isn't working? Or is that kind of the same problem?

    Thanks,
  • Options
    David_SingletonDavid_Singleton Member Posts: 5,479
    Adding two new fields will take you 30 min, plus a couple of hours of testing, and maybe some changes tothe data and its done.

    Take the KISS approach.
    David Singleton
Sign In or Register to comment.