Restrict Field Update Access

As an administrator or implementor, you restrict the access to update fields so that only specific users can edit the fields.

Here's how you can restrict access:

  1. Select the sandbox you want to configure.

  2. Select Navigator > Application Composer and expand the corresponding object.

  3. Click Server Scripts.

  4. Replace the Role Name in the script with the roles created.

  5. Click New in Field Validation.

  6. Add the values as per your requirement.

    Here are the sample roles used in the script:

    • Sales Manager: ZBS_SALES_MANAGER_JOB_CUSTOM

    • Account Manager: CRM_ACCOUNT_MANAGER_CUSTOM

    • Sales Administrator: ZBS_SALES_ADMINSITRATOR_JOB_CUSTOM

Here are the values for the Account object:

Note:

You must enter the error message for the Field Validation Rule as:

The current user doesn't have the privilege to update this field

Rule and Field Name

Rule Definition

Minimum Order Quantity

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('CRM_ACCOUNT_MANAGER_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__MinimumOrderQuantity_c")       
      setAttribute('__ORACO__MinimumOrderQuantity_c',origPri)               
   return false;
}

Minimum Order Amount

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('CRM_ACCOUNT_MANAGER_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
    return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__MinimumOrderAmount_c")       
      setAttribute('__ORACO__MinimumOrderAmount_c',origPri)               
   return false;
}

Account Order Minimums Applied

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('CRM_ACCOUNT_MANAGER_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__ApplyAccountOrderMinimums_c")       
      setAttribute('__ORACO__ApplyAccountOrderMinimums_c',origPri)               
   return false;
}                  

Proof of Purchase Payment Authorized

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__ProofOfPurchasePaymentAuthorized_c")       
      setAttribute('__ORACO__ProofOfPurchasePaymentAuthorized_c',origPri)               
   return false;
}

Coupon Payment Authorized

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__CouponPaymentAuthorized_c")       
      setAttribute('__ORACO__CouponPaymentAuthorized_c',origPri)               
   return false;
}

Customer ID

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__CouponPaymentAuthorized_c")       
      setAttribute('__ORACO__CouponPaymentAuthorized_c',origPri)               
   return false;
}

Taxpayer Name

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__CouponPaymentAuthorized_c")       
      setAttribute('__ORACO__CouponPaymentAuthorized_c',origPri)               
   return false;
}

.

Here are the values for the Route object:

Note:

You must enter the error message for the Field Validation Rule as:

The current user doesn't have the privilege to update this field

Rule Name and Field Name

Rule Definition

Minimum Order Quantity

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('CRM_ACCOUNT_MANAGER_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__MinimumOrderQuantity_c")       
      setAttribute('__ORACO__MinimumOrderQuantity_c',origPri)               
   return false;
}

Minimum Order Amount

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('CRM_ACCOUNT_MANAGER_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
    return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__MinimumOrderAmount_c")       
      setAttribute('__ORACO__MinimumOrderAmount_c',origPri)               
   return false;
}

Route Type

if (adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_ADMINISTRATOR_JOB_CUSTOM') || adf.context.getSecurityContext()?.isUserInRole('ZBS_SALES_MANAGER_JOB_CUSTOM')) {
   return true;
}
else{
      adf.error.raise(null); 
      def origPri = getOriginalAttributeValue("__ORACO__RouteType_c")       
      setAttribute('__ORACO__RouteType_c',origPri)               
   return false;
}