/// <summary>
/// Inserts or updates the data in target.
/// </summary>
/// <param name="_target">
/// A target buffer.
/// </param>
/// <param name="_callInsertLogic">
/// if value is true then call standard insert API otherwise (false) by-pass.
/// </param>
/// <param name="_callValidateLogic">
/// if value is true then call standard validate API otherwise (false) by-pass.
/// </param>
/// <returns>
/// Returns updated target buffer.
/// </returns>
public Common insertUpdate(Common _target, boolean _callInsertLogic = false, boolean _callValidateLogic = false)
{
Common ret;
if (_target.TableId == tableNum(WrkCtrTable))
{
_target.(fieldNum(WrkCtrTable, IsIndividualResource)) = NoYes::Yes;
}
ret = super(_target, _callInsertLogic, _callValidateLogic);
return ret;
}
Class is DMFWrkCtrTableEntity
I am just getting started with DMF in dynamics AX and need a little help with the above code.
I have to delete all records from Resource, that are of type Machine. (WrkCtrTable)
But i have to do it beforehand, that every time i want to insert a CSV file, i need to run a code that executes the above request.
The problem i'm having is that every time a new record is read from the CSV, i am not finding it correct to code the delete logic inside the insertUpdate because the previous record read might be deleted as well (if of type machine).
I want to run the delete code only one time, that is before the update is executed, but i am having trouble finding the right methods to implement the logic.