Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Delete Resource Type Machine

Posted on by Microsoft Employee

/// <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.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Delete Resource Type Machine

    Yes, you understood it correctly!

    Tbh, i don’t really know why i should make that approach.

    This is a requirement straight from the functionals. I dont know all the relations behind it.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Delete Resource Type Machine

    Hi Enea,

    If I understand you correctly then your resource machine data come from 'outside' and you constantly create / import new ones. Before you can do that, you always delete the existing ones. Is my understanding right?

    Assuming that this is correct, why you delete the existing resources and do not only import the new ones?

    Best regards,

    Ludwig

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Delete Resource Type Machine

    Hi,

    The updating logic requires that before each import,  automatically delete all machine type resources. The resources will be recreated through the interface starting from the data contained in the path passed by Machine Management, in this case i import the data from the CSV file.

    This is needed because later on, i have to update each new Resource of type machine with a newly generated working hours Calendar.

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Delete Resource Type Machine

    Hello Enea,

    Why is it that you need to delete the machine resources?

    Can you explain because I do not understand why this is needed.

    Many thanks,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans