Announcements
No record found.
[FormDataSourceEventHandler(formDataSourceStr(PurchReqTable, PurchReqTable), FormDataSourceEventType::Activated)] public static void PurchReqTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e) { FormDataSource purchReqTable_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, PurchReqTable)); FormDataSource purchReqLine_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, PurchReqLine)); FormDataSource inventDim_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, InventDim)); FormDataSource businessJustificationHeader_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, BusinessJustificationHeader)); FormDataSource businessJustificationLine_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, BusinessJustificationLine)); FormDataSource logisticsPostalAddressLine_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, LogisticsPostalAddressLine)); FormDataSource purchReqLineKMCollection_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, PurchReqLineKMCollection)); FormDataSource purchReqExternalSource_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, PurchReqExternalSource)); FormDataSource purchReqLineTaxExtensionIN_ds = sender.formRun().dataSource(formDataSourceStr(PurchReqTable, PurchReqLineTaxExtensionIN)); PurchReqTable purchReqTable = purchReqTable_ds.cursor(); if(purchReqTable.myCondition()) { purchReqTable_ds.allowEdit(false); purchReqLine_ds.allowEdit(false); inventDim_ds.allowEdit(false); businessJustificationHeader_ds.allowEdit(false); businessJustificationLine_ds.allowEdit(false); logisticsPostalAddressLine_ds.allowEdit(false); purchReqLineKMCollection_ds.allowEdit(false); purchReqExternalSource_ds.allowEdit(false); purchReqLineTaxExtensionIN_ds.allowEdit(false); } }
Hello,
It seems you're using allowEdit(false) based on certain conditions in your form's data source, likely through an event handler. Instead of relying on event handlers, you can simplify your approach by directly overriding the form methods.
allowEdit(false)
For example, you can set the edit permission like this:
yourdatasource_ds.allowEdit(false);
Or, for a specific field, you can use:
yourdatasource_ds.object(fieldNum(datasourcetable, field)).allowEdit(false);
This approach reduces complexity and keeps your code organized. For further insights, you may find this blog helpful: Enable/AllowEdit of DataSource Field.
If you have any questions or need more information, feel free to ask!
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our community stars!
Expanding mentorship, skilling, and AI innovation
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 515 Most Valuable Professional
André Arnaud de Cal... 417 Super User 2026 Season 2
CU10121822-0 360