COC of form data source
How to create a COC of the form data source :- Below is the example of the active method
[ExtensionOf(FormDataSourceStr(EntAssetWorkOrderTable, WorkOrderTable))]
final class IHS_EntAssetWorkOrderTable_WorkOrderTable_Frm_Datasrc_Extension
{
public int active()
{
int ret = next active();
FormRun formRun = this.FormRun();
FormDataSource entAssetWorkOrderTable_DS = formRun.datasource(FormDatasourceStr(EntAssetWorkOrderTable, WorkOrderTable));
EntAssetWorkOrderTable entAssetWorkOrderTable = entAssetWorkOrderTable_DS.cursor();
IHSDriverMaster driverMaster;
FormTabPageControl workPlanMaintenance = this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, IHSPerformWorkPlanMaintenance));
FormTabPageControl workPlanPerformWork = this.formRun().design().controlName(formControlStr(EntAssetWorkOrderTable, IHSPerformWorkPlanPerformWork));
//workPlanMaintenance.visible(entAssetWorkOrderTable.IHSIsMaterialMovement == NoYes::Yes);
//workPlanPerformWork.visible(entAssetWorkOrderTable.IHSIsPerformWork == NoYes::Yes);
element.ihsGetFormrun = this.FormRun();
element.ihsEnableDisablePowerApps(formRun, EntAssetWorkOrderTable_DS);
element.ihsEnableDisableAuctionAndEwasteTab(formRun, EntAssetWorkOrderTable_DS);
if(entAssetWorkOrderTable.IHSLogisticsPlanIntExt == IHSLogisticsPlanIntExt::External)
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccount)).enabled(true);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreement)).enabled(true);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSService)).enabled(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverName)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverContact)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverMaster)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSInternalDriverContact)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverMaster)).setValue('');
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSInternalDriverContact)).setValue('');
}
else if(entAssetWorkOrderTable.IHSLogisticsPlanIntExt == IHSLogisticsPlanIntExt::Internal)
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccount)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreement)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSService)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccount)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreement)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSService)).setValue('');
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverMaster)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSInternalDriverContact)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverName)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverContact)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverName)).setValue('');
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverContact)).setValue('');
}
else
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccount)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreement)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSService)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccount)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreement)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSService)).setValue('');
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverName)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverContact)).visible(true);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverMaster)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSInternalDriverContact)).visible(false);
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSDriverMaster)).setValue('');
entAssetWorkOrderTable_ds.object(fieldNum(EntAssetWorkOrderTable, IHSInternalDriverContact)).setValue('');
}
if(entAssetWorkOrderTable.IHSLogisticsPlanIntPerformWork == IHSLogisticsPlanIntExt::External)
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccountPerformWork)).enabled(true);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreementPerformWork)).enabled(true);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSServicePerformWork)).enabled(true);
}
else if(entAssetWorkOrderTable.IHSLogisticsPlanIntPerformWork == IHSLogisticsPlanIntExt::Internal)
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccountPerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreementPerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSServicePerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccountPerformWork)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreementPerformWork)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSServicePerformWork)).setValue('');
}
else
{
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccountPerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreementPerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSServicePerformWork)).enabled(false);
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSVendAccountPerformWork)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSPurchAgreementPerformWork)).setValue('');
entAssetWorkOrderTable_DS.object(fieldNum(EntAssetWorkOrderTable, IHSServicePerformWork)).setValue('');
}
driverMaster = IHSDriverMaster::findRecId(entAssetWorkOrderTable.IHSDriverMaster);
entAssetWorkOrderTable.IHSInternalDriverContact = driverMaster.InternalDriverContact;
return ret;
}
}
Comments
Post a Comment