In this example, a new field by name 'CustomField' on CustInvoiceLine table needs to be populated using FreeTestInvoiceEntity. The method execution will get 'CustomField' from staging table and update it in the target table.
/// <summary>
/// Populate custom field
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(tableStr(FreeTextInvoiceEntity), tableStaticMethodStr(FreeTextInvoiceEntity, copyCustomStagingToTarget))]
public static void FreeTextInvoiceEntity_Post_copyCustomStagingToTarget(XppPrePostArgs args)
{
DMFDefinitionGroupExecution _dmfDefinitionGroupExecution = Args.getArg('_dmfDefinitionGroupExecution');
FreeTextInvoiceStaging staging;
CustInvoiceLine custInvoiceLine;
CustInvoiceTable custInvoiceTable;
custInvoiceLine.skipDataMethods(true);
SelectableDataArea currentCompany = curExt();
update_recordset custInvoiceLine setting
CustomField = staging.CustomField
join custInvoiceTable
where custInvoiceTable.RecId == custInvoiceLine.ParentRecId
join staging
where staging.DefinitionGroup == _dmfDefinitionGroupExecution.DefinitionGroup
&& staging.ExecutionId == _dmfDefinitionGroupExecution.ExecutionId
&& staging.TransferStatus == DMFTransferStatus::Completed
&& staging.LineNumber == custInvoiceLine.LineNum;
}
No comments:
Post a Comment