On SalesLine grid,
I added a field called "Field1" in SalesLine table, to lock the salesline from being edited.
I need to do the following 2 points:
1. If I move between salesLine records, then if this "Field1" record is true, then the record needs to be non editable. And if I stand on a record 'field1' as false, then the record will be editable. I did the code below.
However, it seems if i click edit in the form, all records look editable at first, and when i try to edit one of the fields where 'field1' = no, then the record is converted to non editable. why? it's like it appears for 1 second as editable, then it becomes non editable.
Try it by standing on sales price field for example then move to another record by clicking on sales price directly, you will see it's editable for 1 second then locked, why it's not locked directly? or is this standard behaviour?
[ExtensionOf(formDataSourceStr(SalesTable, SalesLine))]
final class SalesTableFormDataSourceSalesLine_Extension
{
public int active()
{
int ret = next active();
if(ret)
{
if(!Global::isSystemAdministrator())
{
SalesLine salesLine = this.cursor();
if (salesLine)
{
if (salesLine.Field1 == NoYes::Yes)
{
this.allowEdit(false);
}
else
{
this.allowEdit(true);
}
}
}
}
return ret;
}
}
because in point1, i made the whole line as non editable, so how i'm going to say the even though the line is not editable, but u could still edit one field only to make the whole record editable again?