It looks like there is an issue with core_v2_role.List(), and maybe the REST variant as well (I didn't test).
I ran this in the Script Sandbox
let page = core_v2_role.List({ PageIndex: 0, PageSize: 10 }); return [ 'page.PageIndex=' + page.PageIndex, 'page.PageSize=' + page.PageSize, 'page.TotalCount=' + page.TotalCount, ].join('<br>'); ===== OUTPUT ===== page.PageIndex=0 page.PageSize=0 page.TotalCount=0
There are dozens of results returned, but the PageIndex, PageSize, and TotalCount were all 0.
If I call it the method with some arguments I get different results.
let userId = core_v2_user.Accessing.Id; let page = core_v2_role.List({ Include: 'user', PageIndex: 0, PageSize: 5, UserId: userId }); return [ 'page.PageIndex=' + page.PageIndex, 'page.PageSize=' + page.PageSize, 'page.TotalCount=' + page.TotalCount, ].join('<br>'); ===== OUTPUT ===== page.PageIndex=5 page.PageSize=0 page.TotalCount=10
The TotalCount is correct, but the values for PageSize and PageIndex in the result object have been reversed.
I can work around this, but wanted to mention it.
The full version is: 12.1.4.25258