Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

How to get the total record count from an entity and put that value into a form field

Posted on by 160

I want to get the total entity record count when a form is submitted and add that value to a field.  I see how to get the record count for a report, but this is for a form.

I'm using D365 online version 9.x.

Thanks

*This post is locked for comments

  • Suggested answer
    Nishant Rana Profile Picture
    Nishant Rana 55 Microsoft Employee on at
    RE: How to get the total record count from an entity and put that value into a form field

    You'd have do to some customization for that.

    This should help

    nishantrana.me/.../

  • Suggested answer
    Nishant Rana Profile Picture
    Nishant Rana 55 Microsoft Employee on at
    RE: How to get the total record count from an entity and put that value into a form field

    For version 9.0

    dreamingincrm.com/.../

  • Arun Vinoth Profile Picture
    Arun Vinoth 11,613 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Thanks Mike, pls accept the answer & close the thread to help future solution seekers.

  • Verified answer
    Z_Mike Profile Picture
    Z_Mike 160 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Arun,

    Thanks for your suggestion.  I used your solution and it worked.

    Mike

  • Z_Mike Profile Picture
    Z_Mike 160 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Unfortunately, I can't use the auto number function as I need to query the total amount of records per day and not the total records.  I didn't mention that in my description.  Sorry for that.

  • Z_Mike Profile Picture
    Z_Mike 160 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Kokulan,

    Sorry I didn't respond sooner.  There is no parent entity involved with this process.  Thanks for the suggestion.

    Mike

  • Z_Mike Profile Picture
    Z_Mike 160 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Stefan,

    Sorry that I didn't respond sooner.  Your solution will work, but I need the calculation of the record count to be executed after the record is created, so I don't think this will work for me.

  • Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Hi

    You could do this in couple of different ways, but I am going to mention one that involves less work and performance wise a bit better approach

    Assuming the created  record has parent entity,  you could add a roll up field to the parent entity to do the count and then you can have a quick view form on the child entity to display the total record count. It will update on an hourly basis just to make sure the system performance is not affected. But if you want the update instantly, you can manually or programatically force calculate a rollup field to get the number updated but this may affect the performance a bit.

    Let me know if you need more info on this

  • Suggested answer
    StefanS365 Profile Picture
    StefanS365 3,573 Most Valuable Professional on at
    RE: How to get the total record count from an entity and put that value into a form field

    Why not use the standard auto number function of Dynamics 365 CE that can be based on a sequential number,

    You can enable a existing or new field as auto number field.

    Use to XrmToolBox plugin to set the field and its seed (begin number) for this

    www.xrmtoolbox.com/.../Rappen.XrmToolBox.AutoNumManager

    More info about the configuration: http://anm.xrmtoolbox.com/

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: How to get the total record count from an entity and put that value into a form field

    Hi ,

    Plugin is the best options for increment the value to avoid redundancy. Let say if you write logic in client side and get total record count  and at the same moment another user create record in the same entity you may get wrong value at client side. So write a create message , post operation plugin and in the plugin code  get total record using FetHXML and set the value to the field to update.

    You can also do this using workflow but in that case you need to maintain another entity to track the last number. Have a look my article , you may get some idea-

    goutamdascrm.wordpress.com/.../dynamics-365-auto-number

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans