Wish: Sentry field rights override on service extra fields

Status: Reported

Description

Now that service extra fields on company and person level are now also visible at the CRM side we would like to be able to use sentry overrides to hide the field data for specific user groups, this works for CRM user defined fields (although saving an entity where a hidden field has a value is broken, but we can fix that in OnSite), but does not work for service extra fields.
Demo:
2 fields, one created in crm, one created in service, using CRMScript to create userpreferences to block field access.
Fields before setting the userpreferences:

Fields after setting the userpreferences:

The UD field has value 0 and is marked as disabled, read only, but the service extra field behaves exactly the same and can be edited.
CRMScript:
#setLanguageLevel 3;

// delete existing
SearchEngine seDeleteExisting;
seDeleteExisting.addCriteria("UserPreference.prefsection", "OperatorEquals", "Rights-person-Existing");
seDeleteExisting.delete();

// fields to block access to
Map personFields;

personFields.insert("udpersonsmall.long08", "");
personFields.insert("person.x_hidden_field", "");

NSPreferenceAgent preferenceAgent;

for (personFields.first(); !personFields.eof(); personFields.next())
{
  	String personField = personFields.getKey();
  
    NSPreferenceSpec sentryPrefPersonSpec;
  	sentryPrefPersonSpec.SetSection("Rights-person-Existing");
  	sentryPrefPersonSpec.SetKey(personField);
  
  	// preference for hiding the field system-wide
  	NSPreference hidePersonFieldSystemWidePref = preferenceAgent.CreateDefaultPreference();
 
  	hidePersonFieldSystemWidePref.SetSpecification(sentryPrefPersonSpec);
  	hidePersonFieldSystemWidePref.SetLevel(2); // system wide
  	hidePersonFieldSystemWidePref.SetRawValue("0, no access"); // no read or write rights
  
  	preferenceAgent.SavePreferenceEntity(hidePersonFieldSystemWidePref, false);
}

NSDiagnosticsAgent da;

da.FlushCaches();
Note: removing it from the screen using screen designer does not solve it, you can still select on the data using selections)

Details
Issue id 33844
Registered 24 Sep 2022
Last modified 3 Oct 2022
Severity
Area Service
Status Reported
Target release
Type Wish