Disable Editing a Row when the data of a Column in More than 0

Iam trying to HIDE the Pencil Edit for the grid in Picture for the Rows which are Invoiced for Example when INVID > 1 and TINVID >1

But The Bewlow Code Disabled all the PENCIL EDIT ICONS. What went wrong??

Events > onScriptInit >

if ({invid} > 1 && {tinvid} > 1 )
{
sc_apl_conf(“grid_purchases”, “lig_edit”, “off”);
}

Note : I have Tried the Same in “onRecord” Same Issue

Pls Help!!

Got this off my cheat sheet.

//hide edit pencil on grid
//On script Init event
$lvl =[groupid];
if($lvl>1)
{
echo “#bedit{ display:none !important;}”;
OR
On application INIT event

$lvl =[groupid];
sc_apl_conf (“app_name”, “lig_edit”, “off”);
if ($lvl==1)
{
sc_apl_conf (“app_name”, “lig_edit”, “on”);
}