Problems with OnLookup trigger

OrangePieOrangePie Posts: 7Member
I'm quite new to NAV and while trying to filter the OnLookup list I stumbled across some difficulties. I want to limit the number of possible choices, let's say workers, when unrolling the OnLookup list on page. I tried following the guide that seemed to help to achieve a similar result though it didn't quite work for me.
Could anyone point me in the right direction? I played with some built-in functions but a simple SETRANGE doesn't seem to do the trick.


  • SanderDkSanderDk Posts: 323Member
    If you post you code it will be a help to understanding your questen.
    What version of NAV/BC are you using?
    For help, do not use PM, but use forum instead, perhaps other people have the same question, or better answers.
  • OrangePieOrangePie Posts: 7Member
    I'm on 2013. There isn't much code to show since it's been only some functions that I tested.
    Say I have a table and one of its fields is related to data in another table. On page I want to filter the OnLookup list to show only those options in that field that have a certain parameter set to TRUE.
    I tried applying some filters but to no avail.
    After writing the post I found this though:
    Can you at least explain to me where tblItem came from? is it built-in? I didn't find any information in my materials.
  • ShaiHuludShaiHulud Posts: 75Member
    tblItem is a "Record" type variable with subtype "Item" (points to "Item" table);
    Some field - OnLookup() //written in table object
    MyTable.SETRANGE("Filter Field", TRUE); //set your filter on the target table
      //RUNMODAL means it will be run "on top", i.e. you won't be able to progress until you are finished with the new window
      //parameter 0 means that it must open page specified in the table's (MyTable) "Lookup Page ID" property
      //parameter MyTable points to the record we want to open the page with (specific filtered table)
      //ACTION::LookupOK means that we will only execute the below code if the page is closed by pressing "OK" button at the bottom-right
      VALIDATE("Some Field", MyTable."Target Field"); //this is because you most likely want to save the value you looked up, in this case to the "Some Field"
    Arturas Kulsinskas
  • OrangePieOrangePie Posts: 7Member
    Thanks for the succint answer, I've got it now.
  • krikikriki Posts: 8,836Member, Moderator
    [Topic moved from 'NAV/Navision Classic Client' forum to 'NAV Three Tier' forum]

    Regards,Alain Krikilion
    Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
    NAV TechDays 2019: 21 & 22 November 2019, Antwerp (Belgium)
Sign In or Register to comment.