I'm trying to change allowedit value on a single field but can't get into it. This is my actuall code but I get error: Okay did rebuild the models and it's fine
[ExtensionOf(formStr(ProdParmReportFinished))]
final class ProdParmReportFinishedWG_Extension
{
public void init()
{
next init();
ProdTable prodTable;
select firstOnly RecId from prodTable
where prodTable.InventRefType != InventRefType::None
&& prodTable.ProdId == prodTable.InventRefId
&& prodTable.ProdStatus != ProdStatus::ReportedFinished;
prodParmReportFinished_ds.object(fieldNum(ProdParmReportFinished, EndJob)).allowEdit(prodTable.RecId != 0);
}
}
if you are working with extension try something like this
[PostHandlerFor(formStr(YourForm), formMethodStr(YourForm, YourMethod))]
public static void YourForm_xxx(XppPrePostArgs args)
{
FormRun sender = Args.getThis();
sender.control(sender.controlId(formControlStr(YourForm, YourDatasource_Field))).allowEdit(false);
}
With the right click and select copy event handler method the correct structure of the method is copied to you, then you enter your code
Thank you, gonna try it at tomorrow. So I can use this in my statement ? Could you please check my other open thread about verification process ?
I got 3 errors. Invalid token 'sender' , ' sender' noot found in this scope and expected "." after- Validating)]
it seems that you did not create the event handler method correctly
I actually missed class extension so I had no final class. Right now I have something like this. prodParmReportFinished_ds.object(fieldNum(ProdParmReportFinished, EndJob)).allowEdit(prodTable.RecId != 0); But I get errors on next init() method. The form with name ProdParmReportFinished could not be opened. Error executing code: <empty class> object does not have method 'runbase'.