Article: AN0002457Updated: 27.04.2021
In order to hide button Delete in a record detail set the property OGEditOptions.EnabledDelete in the script for record detail (tab Scripts in the detail of the given class).
Following example hides button Delete except for cases where the user has role it-architect or when user created the record and column release_approver is not filled in.
function OnAfterBinding()
{
if (!OG.IsNull(OGDataRowId))
{
var dr = OG.DataRow.GetDataById(OGClassDef.Id, OGDataRowId);
OGEditOptions.EnabledDelete =
dr['creator'] == OG.Person.GetLoginPerson().Account & dr['release_approver'] =='' ||
OG.Person.IsUserInRoleByCode('it-architect');
}
}