Announcements
No record found.
I am trying to iterate through the result of the Xrm.Utility.getGlobalContext().userSettings.roles.getAll() function but when stored in an array, it returns undefined. However when the function is run as is, it returns everything that I need. Can anyone help me out on this? This has been a roadblock to me for quite a few days now. I can't find anything that works from all the other answers I have found here.
Hi kthlnvrgna,
If I am not wrong, the screenshot you provided is the watch from Developer Tools. forEach function wouldn't return the output in watch. You can either go to Console in Developer Tools to see the output or place the same javascript code in webresource by replacing console.log() with alert() so that, you can see the output in alert window.
Watch output under Console:
Javascript Code in webresource:
I am actually in testing on the Console of the Developer tools. And have already tried to simulate in the web resource, it really doesn't return anything. Am I doing something wrong?
May I also ask why you had to have explicitly defined your object for the System Administrator in your forEach()?
Oddly it's working with alert(). Thanks for this.
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.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Muhammad Shahzad Sh... 69 Most Valuable Professional
ManoVerse 62 Super User 2026 Season 1
11manish 43