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

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)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi John

    Try like below in the query range value.

    (CompanyInfo::languageId())

    Thanks,

    Girish S.

  • JohnBright Profile Picture
    115 on at

    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.

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

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

    Thanks,

    Girish S.

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    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

  • JohnBright Profile Picture
    115 on at

    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.

  • GirishS Profile Picture
    27,827 Moderator on at

    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

    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.

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 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans