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 :
Service | Customer Service, Contact Center, Fie...
Answered

Javascript to fetch record count of related entity

(0) ShareShare
ReportReport
Posted on by 2

How do I meet this below requirement? Appreciate your help!!

 

Work Order entity has 1 to many relationship with custom Work Report entity (1 WO can have 1 or many Work Reports).

 

Work Order can not be marked as complete (System status=Complete) when no work report is entered (count =0 of Work Report entity for the given Work Order). I was trying to write javascript on Work Order entity, OnChange event of System Status, to validate this criteria but could not find way how to get the count of the related entity record.

I have the same question (0)
  • Verified answer
    Leah Ju Profile Picture
    Microsoft Employee on at
    Hi Partner,
    Many ways you can use to get child records counts:
    1.Count the number of related child records using a Rollup field
    2.using workflow--CountChildEntityRecord
    3.You can retrieve child records through js code:
     
    --formContext.data.entity.getId(); Returns the current work order ID and then replaces the following object parameters.

    I hope you can verify my answer if it helps you! If you have any questions, please feel free to contact me.
    Regards,
    Leah

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 > Service | Customer Service, Contact Center, Field Service, Guides

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 61 Super User 2025 Season 2

#2
Siv Sagar Profile Picture

Siv Sagar 52 Super User 2025 Season 2

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 42 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans