Показать сообщение отдельно
Старый 09.07.2020, 15:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
crmtipoftheday: Tip #1375: Get record count for entities
Источник: https://crmtipoftheday.com/1375/get-...t-for-entities
==============

I need to perform some data… uhm… “augmentation”. Easy as using Power Automate – get all the records, loop through, fudge I mean augment the data. Right? Except there could be more than 100,000 records. Why 100K? That’s the maximum you can get with the List Records action. (Wanted to insert a reference here but that limit does not seem to be documented at all… Oh, well, save it for another tip). In short: I need quickly to find out the total number of records in couple entities. On top of that, those were the entities not exposed outside of their parent entities, like Order Product or Invoice Product.

Even if you are not a developer there are couple Web API methods you can add to your toolbox and RetrieveTotalRecordCount function is one of them.

https://orgname.crmN.dynamics.com/ap...t(EntityNames=['logical_name_1','logical_name_2', ...])

for example:

https://foobar.crm.dynamics.com/api/...t(EntityNames=['salesorder','salesorderdetail','invoice','invoicedetail'])

This is what comes back:

{ "@odata.context": "https://foobar.crm.dynamics.com/api/data/v9.1/$metadata#Microsoft.Dynamics.CRM.RetrieveTotalRecordCountResponse", "EntityRecordCountCollection": { "Count": 4, "IsReadOnly": false, "Keys": [ "salesorder", "salesorderdetail", "invoice", "invoicedetail" ], "Values": [ 6679, 10547, 17568, 59618 ] }}Nice and easy, right?

Cover photo by Amornthep Srina from Pexels.



Источник: https://crmtipoftheday.com/1375/get-...t-for-entities
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.