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

Community site session details

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

How add range to an entity

(0) ShareShare
ReportReport
Posted on by 115

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. 

I have the same question (0)
  • JohnBright Profile Picture
    115 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
    27,825 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
    115 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
    12,563 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
    27,825 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
    115 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
    27,825 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.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

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

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans