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. 

  • JohnBright Profile Picture
    JohnBright 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
    GirishS 27,821 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 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
    Mohit Rampal 12,554 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,821 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 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
    GirishS 27,821 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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,575 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,493 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans