web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Business Central forum

how to get account sub category code using al vs code for 365 bc ?

(0) ShareShare
ReportReport
Posted on by 339

Dear Experts

how to get account sub category code using al vs code for 365 bc ? i want to filter account subcategory code

but here my below code coming as account category code i dont want to come account category code it should be sub category code kindly check below my code and please help me how to filter account  sub category code

field(1; "Account Sub Category Code"; Integer)
{
DataClassification = CustomerContent;
TableRelation = "G/L Account Category"."Entry No.";
}
I have the same question (0)
  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at

    In your "G/L Account Category" what is the field that contains the Sub Category Code? You need to relate to that field, not Entry No.

  • SABIH Profile Picture
    339 on at

    Hello Stefano

    Could you please share me vs code here .According to your info i just give the related to that field in code but showing as error  please check my below code 

    field(2; "Account Sub Category Code"; Text[30])
    {
    DataClassification = CustomerContent;
    TableRelation = "G/L Account Category".Description;

     
    when i select account sub category code (cash) showing as error "The page has an error. Correct the error or try to revert the change."
     
     
     
  • SABIH Profile Picture
    339 on at

    Dear Stefano

    Finally i resolved the solution please find below my solution

    field(2; "Account Sub Category Code"; Integer)

           {

               TableRelation = "G/L Account Category";

           }

           field(3; "Account Sub Category Description"; Text[30])

           {

               Caption = 'Account Sub Category Description';

               FieldClass = FlowField;

               CalcFormula = lookup ("G/L Account Category".Description where ("Entry No." = field ("Account Sub Category Code")));

           }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans