Field Level Security and Create Scripts

1 minute read time.
The control of field level security can be found against each field listed under the Field tab in the customization area.

Administration | Customization | TableName

We know from the documentation that the field security interface provides a simple code-free approach for administrators to define how users can access the fields associated with a screen.

It is then very easy to make a field invisible or mandatory to some users, allow other users to view the contents of the field but not to change them, and to grant others both read and write rights. These rights are granted either to an individual named user, or to a team or to a security profile membership.

This code free approach doesn't however cover all situations. For example if there is a business rule that states "Only Support team members may change a company SLA field when the company is of type 'Customer'". Then we can't use the Field Level Security.

Here we can only implement this rule with field level scripting.

In the main entry screen for the company (CompanyBoxLong) we can add a onCreate script to the Comp_SLAId field.

var strType = eWare.GetContextInfo("company","comp_type");
if (CurrentUser.user_primarychannelid == 3 & & strType == 'Customer')
{
ReadOnly = false;
}
else
{
ReadOnly = true;
}