web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Import Fixed Asset Table to a new Table with assets filtered by fixed asset group

(0) ShareShare
ReportReport
Posted on by 10

Hello Community,

Please I need assistance.

I have a vehicle implementation project that requests importing vehicle assets from the fixed asset module into another module (with a filter by fixed asset group).

Essentially, a new vehicle is added from Fixed Asset Table  and added to a Fixed Asset Group and acquired normally,

But I also need to import these vehicle assets into another table in a new module I'm developing. So not all fixed asset is imported only the vehicle assets (filtered by fixed asset group).

Please I can go about it? I've tried extending the AssetTable but it doesn't work/

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Peter,

    Will the vehicle assets be present in fixed assets as well (as per standard functionality)? In the case you can write you code in AssetTable\insert method to check for the asset group and insert records into the new table you are developing.

  • Peter Onyegbule Profile Picture
    10 on at

    Hi Gunjan,

    Thanks for your feedback. Yes, it's using fixed assets as per standard functionality.

    You're suggesting

    1. Write my code in the AssetTable\insert method - (to check)

    2. Insert records into the new table.

    I'll try that.

    But how about I extend the AssetTable then perform the insert method and insert record from there. Does that work too?

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Which version are you on? If you are using Dynamics AX, you can write your code in AssetTable\insert() after super call.

    If you are using D365 F&O, you can create a CoC on insert method and write your code there.

    You can check this link for details on using chain of command.

  • Peter Onyegbule Profile Picture
    10 on at

    I'm using D365 F&O and the CoC is the best route. Thanks.

    But I've never tried to filter an asset group directly.

    Please do you have any ideas or resources I can use?

    I'll really appreciate it.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Peter,

    You can do something like this in the CoC method -

    public void insert()
    {
        NewAssetTable newAssetTable;
    
        next insert();
        
        ttsBegin;
        
        if (this.AssetGroup == "Vehicle")
        {
            newAssetTable. = this.AssetId;
            ...
            ... Other fields
            
            newAssetTable.insert();
            
        }
        
        ttsCommitl
    }

  • Peter Onyegbule Profile Picture
    10 on at

    Thanks, Gunjan.

    I'll try it out.

    I really appreciate everything.

    Thanks so much.

  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    No worries!

    Let us know if it works and mark the helpful answer(s) as verified to close the thread.

  • Peter Onyegbule Profile Picture
    10 on at

    Hi Gunjan,

    Sadly I couldn't get it to work.

    So here's what I did.

    1. Extended the AssetTable

    2. Tried to override the insert method but the option was disabled.

    3. So instead I created a new table and did a method override for insert and I added [ExtensionOf(classStr(AssetTable))] and then extends AssetTable.

    I got errors. I still haven't gotten used to coding with x++.

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi Peter,

    You don't need to extend AssetTable for this. For creating a CoC, you need to create a class extending the tables. You can check the link I shared earlier. More specifically, you can check here to see how you can create CoC on table methods.

  • Peter Onyegbule Profile Picture
    10 on at

    Hi Gunjan,

    Thanks for your assistance.

    I used this function as well and it got me the same result, however, I need to add a conditional statement for the insert() function to run only when the Vehicle Id doesn't exist.

    class ImportFAJob
    {
    /// 
    /// Runs the class with the specified arguments.
    /// 
    /// The specified arguments.
    public static void main(Args _args)
        {
            AssetTable assetTable;
            MYVehicleTable myVehicleTable;
            Counter counter; select myVehicleTable;
                try
                    {
                        while select assetTable where assetTable.AssetGroup == "VEHC"
                        {
                            ttsbegin;
                            myVehicleTable.AcquisitionDate_W = assetTable.AcquisitionDate_W;
                            myVehicleTable.AssetGroup = assetTable.AssetGroup;
                            myVehicleTable.AssetId = assetTable.AssetId;
                            myVehicleTable.Name = assetTable.Name;
                            myVehicleTable.insert();
                            counter  ;
                            ttscommit;
                        }
                        
                        info(strFmt("%1 records inserted successfully.",counter));
                    }
                catch(Exception::Error)
                    {
                        info("Caught 'Exception::Error'");
                    }
        }
    }
     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 495 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 315 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans