Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

How to filter D365 Modules by current company ?

(0) ShareShare
ReportReport
Posted on by 203

Hi guys,

I got a table containing all modules going from parent module to childs items and their path.

I got the region code property field coming from this modules and other field like path, labeldid and so on.

Then i wanna use this table in a tree control but i wanna display only modules corresponding to current company like USMF.

My actual issue is to obtain the right modules only, cause i made a filter on region code field but some items are empty or some region code are shared between many items that i dont need.

Could you teach me a way to do it correctly ?

Thanksfully.

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: How to filter D365 Modules by current company ?

    Don't theoretize about another property. Answer the question whether the data is correct or not. If not, what you need to do is fixing the bug that causes invalid input data for your task.

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: How to filter D365 Modules by current company ?

    The current table have been made by another dev and i'm wondering if he did it correctly.

    When i look at the table there is any correspondance with company info, so i didnt understand why they did it like that.

    Is there another property which i could use to make it ? I mean could i add a new field to filter and to display the good data in my form ?

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: How to filter D365 Modules by current company ?

    Because CountryRegionCodes obviously isn't empty, identifying the particular condition is easy. It's this one:

    strContains(securityMenusLocal.CountryRegionCodes, SysCountryRegionCode::countryInfo(curext()))

    If it return false, it means that CountryRegionCodes don't contain the string returned by countryInfo(). In other words, what countryInfo() isn't "BR". You mentioned USMF, which is a US company, not Brazilian, isn't it?

    Nevertheless I doubt that AccountsPayable module is set with this country code. Are you sure that you have correct data in your table?

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: How to filter D365 Modules by current company ?

    Untitledhvhv.png

    Here's the value for the menu Accountpayable.

    But the selection didnt work 

    (securityMenusLocal.CountryRegionCodes == ''
    || (securityMenusLocal.CountryRegionCodes != ''
    && strContains(securityMenusLocal.CountryRegionCodes, SysCountryRegionCode::countryInfo(curext()))))

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: How to filter D365 Modules by current company ?

    Then please debug your code for one of those menus and identify which of these conditions excluded it.

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: How to filter D365 Modules by current company ?

    when i comment the line which contain

    //&& (securityMenusLocal.CountryRegionCodes == ''

    //|| (securityMenusLocal.CountryRegionCodes != '' && strContains(securityMenusLocal.CountryRegionCodes, SysCountryRegionCode::countryInfo(curext())))))

    I'm getting all menus even those which are not appearing on my D365 dashboard.

    So it seems to be there the problem cause it's not filtering correctly what should be on my current company

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: How to filter D365 Modules by current company ?

    So what did you found when you debugged your code? What is the place where it doesn't behave as expected? What do you have in _treeNode variable at the moment?

    It is able to find the menus at all? You said that the problem is in the particular condition, but did you test that? Do you get there General Leger, for instance?

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: How to filter D365 Modules by current company ?

    Here is the way i collect menus and workspaces too  in a batch load class

     goshoom read you soon

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: How to filter D365 Modules by current company ?

    Do you even get menusLocal for these menus?

    I think that the problem is in your logic for getting the list of menus. Unfortunately you've never mention how you do it, therefore it's impossible for us to find the bug in the logic. You'll need to add the missing information.

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: How to filter D365 Modules by current company ?

     I wanna get that result with all modules on USMF company

    Untitledjhjh.png      

    And for now i got that one in my form

    Untitledmlm.png

    So it's missing many menus like 'account payable' 'general ledger' ... and i got some menus that i don't need like 'landed cost'  'mixed reality' ....

    The condition i wrote before seems to not get all the menus i need and i didnt understand why or how to do it differently.

    Thank you goshoom  for your time.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,711 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans