Navigate to a selected record from Lookup - ShowDialog

aquawateraquawater Member Posts: 71
hi all..
we have a "simple" requirement from user.

in sales order form, we would display "total number of sales header" belonging to same customer no.
when user click on the field total, it will show the list of sales header (custom lookup function - showdialog).

is there a way when user select a record, sales order will jump or navigate to selected record ?
any function that i can use in C/AL to simulate a find function?

NAV version: NAV 5.0.
Thanks in advance.


  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    You can check the Customer Information Frame on right side of Sales Orders for reference..
  • Options
    aquawateraquawater Member Posts: 71
    hi mohana,

    thanks for the reply. but that's not what we want.

    maybe i never explain clearly.
    + in form A, there is a field COUNT (which calculated using C/AL)
    + assume form A will display a sales header (current position #5)
    + this field COUNT is a lookup (using onLookup function) which will display the list of sales header, using showDialog

    + user expectation:
    when she selected on a record (click OK or double click) --> position #10,
    it will return to form A, and record will point to position #10, instead of current position #5.

    is there anyway to do that?
  • Options
    MarkHamblinMarkHamblin Member Posts: 118
    This might be what you're looking for:
    SalesHeader.SETFILTER ... // filter the list of records you want the user to choose from based on your "count" list
    IF FORM.RUNMODAL(FORM::"Sales List", SalesHeader) = ACTION::LookupOK THEN
      GET("Document Type"::Order, SalesHeader."No.");
  • Options
    aquawateraquawater Member Posts: 71
    thanks mark.

    it's close...
    but it's not really navigating to selected record, because sub-form data is not updated.
    and it will prompt me whenever I click on anything, e.g. F5, F7, click on next or previous.

    "Do you want to rename the record?"

    Thanks. It works fine after I added CurrForm.UPDATE(FALSE).


    salesHeader.SETRANGE("Document Type", salesHeader."Document Type"::Order);
    salesHeader.SETRANGE("Sell-to Customer No.", "Sell-to Customer No.");
    IF FORM.RUNMODAL(0, salesHeader) = ACTION::LookupOK THEN BEGIN
      GET("Document Type"::Order, salesHeader."No.");
Sign In or Register to comment.