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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Validation based on legal entity

(0) ShareShare
ReportReport
Posted on by 30

Hi all,

  • Can you please let me know how to put validation with legal entity? I tried with select statement with company info table.
  • Some fields need to hide and unhide based on legal entity.
  • Please let me know the best approach 
I have the same question (0)
  • Verified answer
    Blue Wang Profile Picture
    on at

    HI @rp@n,

    Where are you currently staying? Can't get the name?

    You can use this to get your current legal entity name. Then do your verification.

    info(CompanyInfo::findRecId(CompanyInfo::current()).Name);

  • @rp@n Profile Picture
    30 on at

    blue,

    i saw that code before also. i guess the above statement always true for any legal entity means it will execute the if statement.

    suppose i have 2 legal entity - 001 and 002

    note - if user login with legal entity 001

    if(001)

    {

      field.visible(false)

    }

    else

    {

      field.visible(true) //  always true for 002

    }

    if user login with legal entity 002

    if(001)

    {

      field.visible(false)

    }

    else

    {

      field.visible(true) //  always true for 002

    }

  • Blue Wang Profile Picture
    on at

    Hi @rp@n,

    i guess the above statement always true for any legal entity means it will execute the if statement.

    -

    What do you mean? For the legal entity you need to verify.

    Describe your needs in detail, or what difficulties did you encounter in the middle?

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    If you want to enable certain functionality for legal entity, the best option is to create parameter in some parameter table (CustParameters, VendParameter etc) and if parameter is enabled (checkbox marked in parameter table) use your logic. In this case you have more flexibility in case if you need to use the same feature in another legal entity.

    If you want to enabled feature for country (not for one legal entity, but for all legal entities linked to certain country), you can use method SysCountryRegionCode::isLegalEntityInCountryRegion (check as example BankAccountReconcile class method main)

  • @rp@n Profile Picture
    30 on at

    hi Blue and Sergei,

    basically my requirement is like for example --

    module - Product information management

    form - Released products

    Note - Customer don't wants some customized fields in the form Released product.,those customized fields are used in other legal entities as well.

    like for other module also like AR,AP, Inventory etc...

    So, i wants to hide those ( customized fields) from particular form based on legal entity.

    for Japan legal entity - wants to hide those customized fields

    for other legal entities -  visible as it is.

    i hope it's clear now.

    kindly let me know the best approach please

    please give me more shed on this.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    If it's related to country-specific functionality (Japan), I suggest to use SysCountryRegionCode::isLegalEntityInCountryRegion

    //Form init method
    
    #ISOCountryRegionCodes
    
    field.visible(!SysCountryRegionCode::isLegalEntityInCountryRegion([#isoJP]));

  • @rp@n Profile Picture
    30 on at

    ok, thanks

    one more thing, kindly clarify me on this

    see i have 4 legal entities

    legal entity 1 country US

    legal entity 2 country China

    legal entity 3 country Germany

    legal entity 4 country Japan

    shall i use the above code for my requirements ?

  • Blue Wang Profile Picture
    on at

    Hi @rp@n,

    Ok , I see. Then I agree with Sergei.

    You can refer this:

    daxmusings.codecrib.com/.../creating-country-specific-features-in.html

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi @rp@n,

    Yes, it will work in this case.

  • @rp@n Profile Picture
    30 on at

    thanks sergei,

    i also like you suggestion, to add some parameters in Parameter form. So, based on the check yes or no we can put validation based on legal entity.

    can i do that also?

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 611 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 529 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 285 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans