RE: How to enable/disable form data source property
Hi Jenifer,
Usually fields set as Visible::No have their visibility handled by code.
So, if you search the form for the field name you will probably find some logic to turn its visibility on/off.
I would advise you to understand what business rule drives the field visibility prior to writing any code, most cases like this end up being configuration related.
Anyway, if after understanding the visibility rules behind the field you still need to change its visibility by code you will need an event handler (or CoC), since you are talking about an out of the box form.
Here is an example:
[FormEventHandler(formStr(CustTable), FormEventType::PostRun)]
public static void CustTable_OnPostRun(xFormRun sender, FormEventArgs e)
{
sender.dataSource(formDataSourceStr(CustTable, CustTable))
.object(fieldNum(CustTable, AccountNum))
.visible(true);
}
In this example I used the OnPostRun event of the CustTable form to change the visibility of the CustAccount field.