Select Item Code by condition

Hi Everybody,

On Nav 2013 I create 1 page with table Sales Line (ID - 37). I want on Lines when select Type ::Item and No. is

condition I add on page (Only select the Item Code "Inventory Posting Group" = FINISHED)

But it's not work. Please help me fix Code. Thanks very much
ItemRec.RESET;
ItemRec.SETRANGE("Inventory Posting Group",'FINISHED');



  • Hello,

    Open the Page that you created, for my demo i used page 46 and write the below code in 
    No. - OnLookup(VAR Text : Text[1024];) : Boolean Trigger

    No. - OnLookup(VAR Text : Text) : Boolean
    //>>BKS - 102017
    IF Type = Type::Item THEN BEGIN
    ItemL.SETFILTER("Inventory Posting Group",'FINISHED');
    IF PAGE.RUNMODAL(0,ItemL) = ACTION::LookupOK THEN
    "No." := ItemL."No.";
    END;

    IF Type = Type::"G/L Account" THEN BEGIN
    IF PAGE.RUNMODAL(0,GLAccountL) = ACTION::LookupOK THEN
    "No." := GLAccountL."No.";
    END;

    IF Type = Type::" " THEN BEGIN
    IF PAGE.RUNMODAL(0,StandardTextL) = ACTION::LookupOK THEN
    "No." := StandardTextL.Code;
    END;

    IF Type = Type::Resource THEN BEGIN
    IF PAGE.RUNMODAL(0,ResourceL) = ACTION::LookupOK THEN
    "No." := ResourceL."No.";
    END;

    IF Type = Type::"Fixed Asset" THEN BEGIN
    IF PAGE.RUNMODAL(0,FixedAssetL) = ACTION::LookupOK THEN
    "No." := FixedAssetL."No.";
    END;

    IF Type = Type::"Charge (Item)" THEN BEGIN
    IF PAGE.RUNMODAL(0,ItemChargeL) = ACTION::LookupOK THEN
    "No." := ItemChargeL."No.";
    END;
    //<<BKS - 102017

     

    Note:

    Here ItemL is a local variable of Item Table.

    GLAccountL is a local variable of G/L Account Table.

    StandardTextL is a local variable of Standard Text Table.

    ResourceL is a local variable of Resource Table.

    Similarly you have to create a variable for Item Charge and Fixed Asset, and write below code for lookup as per your requirement.

    See the attached snap.

  • In reply to Binesh Singh Rajput:

    Thanks you Binesh
  • In reply to Binesh Singh Rajput:

    After add Code and select Item Code then Description no auto on Lines.

  • In reply to dinhson:

    Hello,
    I think you had some customization, if it so then you have to VALIDATE "No." so SalesLine."No." Field can be validated, and it will be populated, If you see Table 37 Field "No." OnValidate then you can understand.

    if you don't want to validate "No." Field then you have to add little bit more, something like:
  • In reply to dinhson:

    Hello dinhson,

    if this solutions helped you, then Click on This helped me,

    so other members also will be benified

Related