Sample JPO for Controlling Access

You can define a JPO method for controlling access to UI components.

The following settings are required for the component whose access you want to control:


  • Access Program=<JPO Name>
  • Access Function=<JPO method name>

Access Function gets the input parameter as a HashMap, which contains all the request parameters that were passed into the Form page. The method can use this Map to obtain any request parameters that are required for processing and deciding access.

This method returns a Boolean. The value is true if the component is accessible to the current user context and the given object, if any. Otherwise the value is false and the component is hidden. Here is a template for a JPO function that controls access for a form field:

public static Boolean methodName(Context context, String[] args) 
throws Exception
{
    // Define a boolean to return        
      Boolean bFieldAccess = new Boolean(true);
       HashMap requestMap = (HashMap) JPO.unpackArgs(args);      
    // Get the parameter values from  "requestMap" - if required
String  objectId = (String) requestMap.get("objectId ");
    String  relId = (String) requestMap.get("relId ");
String  languageStr = (String) requestMap.get("languageStr");
    // Do the necessary processing to define access and assign 
true/false to bFieldAccess
    ....
    bFieldAccess = new Boolean(true); 
// (or) 
// bFieldAccess = new Boolean(false); 
    return bFieldAccess;
 }