Sentry field rights override on service extra fields

David Hollegien 6 Sep 2022


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.


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.


#setLanguageLevel 3;

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

// fields to block access to
Map personFields;

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

NSPreferenceAgent preferenceAgent;

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

NSDiagnosticsAgent da;


Is this supposed to work? or is there another way to do this (Note: removing it from the screen using screen designer does not solve it, you can still select on the data using selections)


RE: Sentry field rights override on service extra fields

Samuel Holmström 24 Sep 2022