Purpose:
Product:
Development approach:
Development:
- Create a COC of a standard form method enabling/disabling the form controls. In this case, we are creating a COC of a standard method VendInvoiceJournal form.
- Please find the COC method definition as follows.
[ExtensionOf(formDataSourceStr(VendInvoiceJournal, VendInvoiceJour))]
final class VendInvoiceJournal_Extension
{
public int active()
{
int ret;
next active();
/// to get current record
VendInvoiceJour vij = this.cursor();
//The workflow fields based on workflow icon on header should be visible only if there is a workflow history available this invoice
VendInvoiceInfoTable localvendInvoiceInfoTable = VendInvoiceInfoTable::findSourceDocumentHeader(vij.SourceDocumentHeader);
// to get form controls through foem run
FormRun formrun = this.formRun() as FormRun;
// enables if workflow is attached for particular invoice
if (Workflow::findTrackingStatusForDocument(localvendInvoiceInfoTable))
{
var subby = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_SubmittedBY));
var subdate = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_SubmittedDate));
var appdate = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_AprrovedDate));
var appby = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_AprrovedBY));
subby.visible(true);
subdate.visible(true);
appdate.visible(true);
appby.visible(true);
}
else
{
var subby = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_SubmittedBY));
var subdate = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_SubmittedDate));
var appdate = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_AprrovedDate));
var appby = formrun.design().controlName(formControlStr(VendInvoiceJournal, VendInvoiceJour_AprrovedBY));
subby.visible(false);
subdate.visible(false);
appdate.visible(false);
appby.visible(false);
}
return ret;
}
}
Comments
Post a Comment