Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / How add range to an en...
Finance forum
Answered

How add range to an entity

Posted on by 85

Hi experts, 

I have added a custom entity and I need to add a range to it which should be applied when executing OData. So I have a field for project stage in my entity, every time when I execute Odata, the ranges should be applied to the language field with the value of language of current company. 

I tried adding range to the range function of the entity's data source but I can only hard code the language Id and I can't fetch the current company language Id dynamically. 

Can anyone please suggest solution for the same? Thanks in advance. 

  • JohnBright Profile Picture
    JohnBright 85 on at
    RE: How add range to an entity

    Hi Girish. To answer your question. Yes the current company has the language Id selected.

    However the issue is solved now. As you and Mohit suggested, I used the range property of the data source of the entity. But used (currentLanguageId()) function instead of (CompanyInfo::languageId()). That resolved my issue.

    Thank you for your time Girish and Mohit! Appreciate it.

  • GirishS Profile Picture
    GirishS 27,828 Moderator on at
    RE: How add range to an entity

    Have you checked whether CompanyInfo table has language id filled in.

    Open CompanyInfo in table browser and check the language id against the company you are checking in.

    From the front end Navigate to Organization administration >. Legal entities >. Under General tab check whether you had language id specified.

    Thanks,

    Girish S.

  • JohnBright Profile Picture
    JohnBright 85 on at
    RE: How add range to an entity

    Hi Girish and Mohit, thank you for your time responding. Appreciate it.

    Girish, As I mentioned I tried adding (CompanyInfo::languageId()) in the ranges under the data source but it does not return and apply the value to the range. However this range works for me only when I hardcode the value in range. For example if I hardcode en-Us instead of giving the static method mentioned above, it gets filtered with the respective language. Please can you let me know if I am missing something here.

    Mohit, In the screenshot in the thread, they have mentioned the value as Purch as an hard coded value. But in my case, I need to apply range with the language of current company which should be fetched dynamically for respective company.

    Can you please guide on the same. Thanks in advance.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,540 Moderator on at
    RE: How add range to an entity

    Hi John, As Girish mentioned, try adding range in Datasource of the Data entity. Check the screenshot in below thread.

    community.dynamics.com/.../adding-new-range-to-standard-entity

  • Verified answer
    GirishS Profile Picture
    GirishS 27,828 Moderator on at
    RE: How add range to an entity

    Yes, try to add under the DataSource of the entity.

    Thanks,

    Girish S.

  • JohnBright Profile Picture
    JohnBright 85 on at
    RE: How add range to an entity

    Hi Girish

    Thanks for your time in responding.

    Can you explain on where to add the range? Are you mentioning to add this range in ranges section under the data source(Table) of the entity which is what I tried and it's not getting filtered accordingly. Should we add this range in any method of the entity?

    Can you please guide? Thanks in advance.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,828 Moderator on at
    RE: How add range to an entity

    Hi John

    Try like below in the query range value.

    (CompanyInfo::languageId())

    Thanks,

    Girish S.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

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

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,246 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,041 Super User 2024 Season 2

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans