web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Disable XDS policy on a lookup

(0) ShareShare
ReportReport
Posted on by 190

Hello,

I have implemented an XDS policy on projTable for a certain role to view only projects with a specific type.

However, on the Timesheet screen I want to disable or bypass this policy so that the user with this role can add lines for all projects.

I tried doing this by extension on the lookup method of the formControl (on TSTimesheetEntry form):

public void lookup()
{
       unchecked(Uncheck::XDS)
       {
           next Lookup();

       }

}

But this is not working. On the timesheet lines I can see all project as intended but if I select one of the projects that is filtered out by my xds policy I get the error "Project ID ___ doesn't exist in the company ___. Select a valid project ID with respect to the legal entity specified in this timesheet line."

Is there any way to do this? Or am I missing something?

I have the same question (0)
  • Mariano Gracia Profile Picture
    on at
    RE: Disable XDS policy on a lookup

    I think your problem is that although you have skipped the XDS on the lookup, once the value is selected the validate field event is thrown, and once again your security policies are checked because the kernel evaluates the relation, you can't skip the validatefield event with extensions, so I think you'll have to look for another solution, maybe you could only restrict the projects in the main form?, I now it's annoying because it means the user will be able to query all the projects in the reports, wich are quickly restricted with XDS policies...

  • rachelgomez Profile Picture
    on at
    RE: Disable XDS policy on a lookup

    To disable XDS policy in AX 2012 follow this steps

    xdsServices.setXDSState(0);

    However, this method does not exist in new AX any more. Now we need to wrap code where we want to disable XDS policy with unchecked(Uncheck::XDS)

    unchecked(Uncheck::XDS)

    {

       select ValidTimeState(_asOfDate) maxof(ValidTo) from hcmEmployment

           where hcmEmployment.Worker == _workerRecId;

    }

    Greeting,

    Rachel Gomez

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    297,231 Super User 2025 Season 2 on at
    RE: Disable XDS policy on a lookup

    Hi Oush,

    There is another workaround possible. You can create a new view based on the Project table and override the lookup() method to have an own lookup of projects using the view. As the view has another name, it is not restricted if it has not been setup as constrained table on your XDS policy.

  • ergun sahin Profile Picture
    8,816 Moderator on at
    RE: Disable XDS policy on a lookup

    This is the standard behavior of XDS, this is normal.

    You could try expanding a bit more where you typed "Uncheck" codes.

    I haven't tried it, but writing to modifield might do the trick. You can focus on Validates, or you can try to bypass XDS on the whole form by typing directly into the form's run method.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Sohaib Cheema Profile Picture

Sohaib Cheema 665 User Group Leader

#2
Martin Dráb Profile Picture

Martin Dráb 595 Most Valuable Professional

#3
Yng Lih Profile Picture

Yng Lih 558

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans