Hello!
It has come to light that in 11.5 all EJUSER FLAGS have been ported to UserPreferences.
Here is a listing of all user preferences and their default values (if not already set)
var strDefaultNumExpandedMsg = "3";
var strDefaultRequestStatus = "0";
var strDefaultMessageStatus = "0";
var strRequestDefaultCategory = "-1";
var strDefaultOwner = "1";
var strBitSet = "1";
var strBitNotSet = "0";
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.NumExpandedMsg, strDefaultNumExpandedMsg
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.DefaultRequestStatus, strDefaultRequestStatus
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.DefaultMessageStatus, strDefaultMessageStatus
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.RequestDefaultCategory, strRequestDefaultCategory
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.DefaultOwner, strDefaultOwner
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.ShowLastOnTop, strBitSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.PreviewImageAttachment, strBitSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.NewWindowWhenAdding, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.NoWarnOnLoss, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.SimplifiedEditor, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.SingleLineBreaks, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.CheckBoxOnLeft, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.OwnRequestsOnly, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.AutoQuoteLastmessage, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.OnlyOpenInFavourites, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.OnlyOwnCategories, strBitNotSet
UserPreferenceStrings.Request.Section, UserPreferenceStrings.Request.UseLastCategory, strBitNotSet
// Notification preferences
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyCustomMessage, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyFavouriteRequest, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyRequestAssignedAway, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyRequestActivated, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyRequestEscalated, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyNewMessage, strBitSet
UserPreferenceStrings.Notification.Section, UserPreferenceStrings.Notification.NotifyNewRequest, strBitSet
// Email notification preferences
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailCustomMessage, strBitSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailFavouriteRequest, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailRequestAssignedAway, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailRequestActivated, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailRequestEscalated, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailNewMessage, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailNewRequest, strBitNotSet
UserPreferenceStrings.NotificationEmail.Section, UserPreferenceStrings.NotificationEmail.NotifyEmailOpenRequestsNotRead, strBitNotSet
// Sms notification preferences
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsCustomMessage, strBitSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsFavouriteRequest, strBitSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsRequestAssignedAway, strBitNotSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsRequestActivated, strBitNotSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsRequestEscalated, strBitNotSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsNewMessage, strBitNotSet
UserPreferenceStrings.NotificationSms.Section, UserPreferenceStrings.NotificationSms.NotifySmsNewRequest, strBitNotSet
We apologize for any inconvenience with integrations.
Best regards.
All Replies (4)
Hi Tony, thanks for the heads up. This will probably affect quite a lot of our solutions.
In CRMScript it seems like the User class's .getValue("flags") still return data from the ejuser table, not preferences.
Here is an exampe of how we use the flags, and if this worked against the underlying Preference table it wouldn't be a problem, but if we have to rewrite hundreds of scripts to use Preferences instead then we have quite a lot of work to do.
Old way:
FHBitSet flags;
flags.set(getActiveUser().getValue("flags"));
Bool useLastCategory = flags.getBitNo(2);
printLine(useLastCategory.toString());
New way:
NSPreferenceAgent a;
NSPreference pref = a.GetPreferenceByName("request", "useLastCategory", 5);
Bool useLastCategoryNew = pref.GetRawValue().toInteger().toBool();
printLine(useLastCategoryNew.toString());
It would have been very nice if User.getValue("flags") read values from UserPreference instead of the old ejuser.flags column. That would save us a lot of rewrites.
Hi Frode,
Your suggestion should already be supported. I was previously unaware of work earlier this year in preparation for this. As I understand it, when getting flags with FHBitSet, it will read from preferences, not the ejuser.flags column.
Using SearchEngine toward the ejuser table does not read from preferences.
Awaiting confirmation.
Recieved confirmation from Stian that it does works as expected. So when getting the flags from the User class (or getActiveUser() like in this example) it works.
However, be advised that the values are cached in the fast cgi process, so takes some time before the caches are cleared from all fastcgi instances.
@Frode, bit number 2 is not the "Use last category" preference. You should get bit number 1 like this:
FHBitSet flags;
flags.set(getActiveUser().getValue("flags"));
Bool useLastCategory = flags.getBitNo(1);
printLine(useLastCategory.toString());
@Bas, ejuser.flags is not getting updated when preferences are changed. ejuser.flags has no concept of the preference hierachy (associate, usergroup, database, system) and therefore doesn't translate.
Best regards.
Thanks for checking up on this Tony! Good to hear that getValue("flags") already reads from preferences. I see now that my example checks against the wrong bit, thanks for the catch :)