Sentry field rights override on service extra fields

lock
push_pin
done
Answered
1

Hello,

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();

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)

6 Sep 2022 | 10:39 AM

All Replies (1)

Hi!


We registed it as a wish here: ID 33844

Wish you a great week. 

24 Sep 2022 | 05:13 PM

Add reply