We're using Dynamics AX 2012 R2 CU7 and using XDS policies with some of our security roles.
The problem is that one role needs to confirm a sales order that was entered by another role. Both roles have XDS security policies on them. During the confirmation, XDS security kicks in and causes issues, so the game plan was to use the XDSServices class to turn off XDS security during the confirmation process.
This is effectively what is in our codebase to do the work in the FormLetterService class.
[SysEntryPointAttribute] FormletterOutputContract postSalesOrderConfirmation(SalesFormLetterConfirmContract _contract) { XDSServices xdsServices; formLetterContract = _contract; xdsServices = new XDSServices(); xdsServices.setXDSState(0); this.run(); xdsServices.setXDSState(1); return outputContract; }
Here's where it gets fun. If CIL is enabled, this does not work. I've captured the process via the Tracing Cockpit and seen the queries where XDS is appending to the sql queries.
Here's where it gets really fun. If I run without CIL, this works great. The Sales Order confirms with no issues. It looks like the XDS security gets disabled as expected and re-enabled at the end. Because of this, I'm very confused. I'm not sure if it's cause maybe the code is jumping tiers or getting out of scope for some reason, but it's pretty annoying.
Anyone have any ideas or suggestions? I did see a comment around using the RunAs to the block of code as a different user, but that would probably be a pile more work in the end. But, if it's a pile of work that'll fix my issue, I'm willing to head that route.
*This post is locked for comments
AX in some cases opens a new worker thread or UserConnection, for which the XDS state probably does not apply.
Disabling XDS works pretty well for our custom AIF services where it only exists in one worker/connection session, so maybe your issue is the multiple workers indeed. The solution in that case would be to wrap the whole call in RunAs with a user account who does have the correct access rights without XDS indeed.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156