Skip to main content
Solved

Check user access to a screen

  • December 4, 2024
  • 1 reply
  • 22 views

adriaan17
Freshman I
Forum|alt.badge.img

I am developing a customization and would like to check if a user has access to a specific screen (or a Graph for that matter) in my code, I need to perform certain actions if they do not. How would I do that in my graph, which is not the same graph/screen?

Best answer by countrdd

// Replace with the screen ID you want to check, e.g., "AR301000" for AR Invoices and Memos

const string screenID = "AR301000";

// Check if the user has access to the screen

if (!PXAccess.VerifyRights(screenID))

    {

     // User does not have access - handle the logic here
      throw new PXException("You do not have access to the required screen: {0}", screenID);

    }

 

 var graphType = typeof(PX.Objects.AR.ARInvoiceEntry);

 if (!PXAccess.VerifyRights(graphType))

     {

      // User does not have access - handle the logic here

       throw new PXException("You do not have access to the required Graph: {0}", graphType.Name);

    }

 

 

View original
Did this topic help you find an answer to your question?

1 reply

  • Freshman II
  • 3 replies
  • Answer
  • December 4, 2024

// Replace with the screen ID you want to check, e.g., "AR301000" for AR Invoices and Memos

const string screenID = "AR301000";

// Check if the user has access to the screen

if (!PXAccess.VerifyRights(screenID))

    {

     // User does not have access - handle the logic here
      throw new PXException("You do not have access to the required screen: {0}", screenID);

    }

 

 var graphType = typeof(PX.Objects.AR.ARInvoiceEntry);

 if (!PXAccess.VerifyRights(graphType))

     {

      // User does not have access - handle the logic here

       throw new PXException("You do not have access to the required Graph: {0}", graphType.Name);

    }

 

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings