Hi @idrusm52
I’m NOT sure, why access rights are NOT working for you. Better raise a support ticket with Acumatica.
As you are looking for code, the below customization will work to enable the “TermID” field for only the Administrator role.
public class SQLConstants
{
public class Administrator : PX.Data.BQL.BqlString.Constant<Administrator>
{
public Administrator() : base("Administrator") { }
}
}
public class SOOrderEntrySHExt : PXGraphExtension<SOOrderEntry>
{
protected virtual void SOOrder_TermsID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
SOOrder row = e.Row as SOOrder;
if (row != null)
{
UsersInRoles objUsers = PXSelect<UsersInRoles, Where<UsersInRoles.username, Equal<Current<AccessInfo.userName>>,
And<UsersInRoles.rolename, Equal<SQLConstants.Administrator>>>>.Select(Base);
PXUIFieldAttribute.SetEnabled<SOOrder.termsID>(cache, row, objUsers != null);
}
}
}
You can also achieve this, by having PXUIEnaled() at DAC level instead of field selecting event.
Hope this helps!!