Open journal lines form from the custom form using x++.
- We need to add ledgerJournalTable in the form data source and don't give any properties.
- Copy the JournalLines_Review button from the LedgerJournalTable form.
Write the below code in the Form.
public class Form1 extends FormRun
{
LedgerJournalFormTable journalFormTable;
public void init()
{
journalFormTable = LedgerJournalFormTable::construct(element);
journalFormTable.datasourceInitPost(LedgerJournalTable);
super();
}
JournalForm journalForm()
{
return journalFormTable;
}
}
Button clicked method. (copied from LedgerJournalTable)
[Control("MenuFunctionButton")]
class JournalLines_Review
{
/// <summary>
/// Handles the Lines->Review button's clicked event.
/// </summary>
public void clicked()
{
journalFormTable.assertJournalNotInUse();
journalFormTable.parmIsProcessingPaymentOnApprovedJounal(false);
journalFormTable.parmIsWFApprovedModeSelected(true);
super();
ledgerJournalTable_ds.reread();
}
}
The below code I have written in jumpRef method is based on my requirement.
[Control("String")]
class Table1_FieldString1
{
public void jumpRef()
{
super();
LedgerJournalTable ledgerJournalTableNew = LedgerJournalTable::find(Table1.FieldString1);
//ledgerJournalTable_ds.setRecord(ledgerJournalTableNew);
ledgerJournalTable_ds.findRecord(ledgerJournalTableNew);
//ledgerJournalTable_ds.reread();
//ledgerJournalTable_ds.refresh();
journalFormTable.datasourceInitPost(ledgerJournalTable_ds.cursor());
JournalLines_Review.clicked();
}
}
Another Way:
Keep daxing!!
No comments:
Post a Comment