Hello! I've recently come across a support ticket where certain users are unable to create a new contact.
Reason being a trigger we created several years ago now throws an error.
In this trigger we run NSNumberAllocationAgent.SaveCountRefEntity() in context of a user, but this only works for users with user level 0,
We're not sure if the customer has done any changes to their users, or if the access rights for this method has changed with SuperOffice release 11.5?
Example code:
#setLanguageLevel 4;
NSNumberAllocationAgent numAllocAgent;
NSRefCountEntity contactNumberEntity = numAllocAgent.GetRefCountEntity(96); // 96 = Contact number counter
Integer incrementedNumber = contactNumberEntity.GetCurrentValue() + 1;
// Save the incremented number to counter in database
contactNumberEntity.SetCurrentValue(incrementedNumber);
numAllocAgent.SaveRefCountEntity(contactNumberEntity); // This one fails!!
Throws error for users outside user level 0:

Alle Svar (2)
Hi Eivind,
If you have seen my post about security fixes pertaining to other agents, it's possible this is another cascading consequence I was not aware of. I'll investigate.
Best regards.
Hi Eivind,
Yes, I can confirm that this was also included in recent security fix deployed in 11.5. I beleive the mindset is that things that can only be done in Settings and maintenance are things that should only be done by administrators.
It's our business logic that increments Contact numbers when new companies are created. It's not known when these values should be changed otherwise, so we would very much be interested in learning more about your use case that doesn't match the intended behavior.
I see you using CRMScript for this - in the context of a non-admin user. If this was a custom application you could perform the changed as a system user.
Please send me an email with more context and I'll take it up with the product team for evaluation.
Best regards.