Keys

manishgoyal
manishgoyal Member Posts: 52
Can we activate or deactivate keys by coding????
Manish Goyal

Comments

  • chengalasettyvsrao
    chengalasettyvsrao Member Posts: 711
    I want to say NO.
  • Albertvh
    Albertvh Member Posts: 516
    Hi,
    You could try setting key groups and then use
    KEYGROUPDISABLE Function
    KEYGROUPENABLED Function
    Check the online help.
  • manishgoyal
    manishgoyal Member Posts: 52
    no i just want to know can be activate/ deactivate keys using C/AL.
    Manish Goyal
  • Albertvh
    Albertvh Member Posts: 516
    If you don't use keygroups then the answer is No

    If you set a keygroup on let say the customer table
    Enabled	Key		         KeyGroups
    Yes	VAT Registration No        VAT
    
    in C/AL
    Customer.KEYGROUPENABLE(VAT);
    
  • ssingla
    ssingla Member Posts: 2,973
    no i just want to know can be activate/ deactivate keys using C/AL.

    The basic question is : Why are u trying to do this?
    CA Sandeep Singla
    http://ssdynamics.co.in
  • Slawek_Guzek
    Slawek_Guzek Member Posts: 1,692
    Yes, you can manipulate keys from C/AL code. Without using key groups and KEYGROUPENABLE or KEYGROUPDISABLE functions.

    Regards,
    Slawek
    Slawek Guzek - www.yitron.co.uk
    Business Central, MS SQL Server, Wherescape RED;
  • matteo_montanari
    matteo_montanari Member Posts: 189
    Yes, you can manipulate keys from C/AL code. Without using key groups and KEYGROUPENABLE or KEYGROUPDISABLE functions.

    Regards,
    Slawek

    Hi

    A little example:

    KeyRec is a record of table "Key"
    KeyRec.SETRANGE(TableNo,18);
    KeyRec.FINDLAST;
    KeyRec.Enabled := TRUE;
    KeyRec.MODIFY;
    

    This example enable the last key of table "Customer".
    I think it require table designer granule (if this code is executed with a customer nav license...)

    Bye

    Matteo
    Reno Sistemi Navision Developer