Error message Employee No. " does not exist

poppinspoppins Member Posts: 647
Hi everyone,

I got the following error while trying to run a form :
Employee No. " does not exist

I tried to debug the C/AL code, the error seems to be in this line:
Employee.GET(GETFILTER("Employee No."));

I checked the Employee table, the Employee No. already exists in the table....

What should I do???

Comments

  • mohana_cse06mohana_cse06 Member Posts: 5,504
    poppins wrote:
    Employee.GET(GETFILTER("Employee No."));
    
    Did you try
    Employee.GET("Employee No.");
    
  • ChinmoyChinmoy Member Posts: 359
    If you want avoid this error.. you can put:

    IF GETFILTER("Employee No.") <> '' THEN
    Employee.GET(GETFILTER("Employee No."));

    However, I suggest, you find out why the filter on "Employee No." field is not set, when it is expected to be.

    Chn
  • poppinspoppins Member Posts: 647
    poppins wrote:
    Employee.GET(GETFILTER("Employee No."));
    
    Did you try
    Employee.GET("Employee No.");
    

    Yes I did, same error message...
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    In which trigger you have the above code?
    Either you have it in place where record is not get like OnOpen or the employee code is blank in record..
  • vijay_gvijay_g Member Posts: 884
    The error is coming because of you are not assigninn any filter to emp no. while running this to avoid this error try this code
    IF GETFILTER("Employee No.") <> '' THEN
    Employee.GET(GETFILTER("Employee No."));
    
  • poppinspoppins Member Posts: 647
    In which trigger you have the above code?
    Either you have it in place where record is not get like OnOpen or the employee code is blank in record..

    The code is in the trigger OnOpenForm()...
    I checked, the employee code is not blank...
    So, what should I do???
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    You will not have record in OnOpen form

    you have to shift the code to OnAfterGetRecord..

    to check simply add
    Message('%1',"Employee No.");
    
  • ufukufuk Member Posts: 514
    Is this a card or list type form? If it is card then it doesn't matter using OnOpenForm (but not triggered when switching between records) or OnAfterGetRecord triggers. If it is a list then you can use OnAfterGetRecord trigger. All depends what you are trying to do.
    Ufuk Asci
    Pargesoft
Sign In or Register to comment.