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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Associate each fixed asset automatically with it's fixed asset financial dimension value once a fixed asset is created

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

I would like to associate each fixed asset automatically with it's fixed asset financial dimension value once a fixed asset is created. (Please note that I setup an automatic financial dimension that automatically created a dimension value for each fixed asset created). My problem is that everything that I tried so far did not properly work and would thus like to ask whether somebody could provide me some hints on how to modify the AX code in order to make the fixed asset financial dimension value field automatically defaulting on the asset book(s) that are associated with the fixed asset.

Hope somebody can help.

Many thanks in advance,

Ludwig

*This post is locked for comments

I have the same question (0)
  • 5400 Profile Picture
    7,162 on at

    Hope you have created the setup for auto defaulting financial dimension during fixed asset creation. I assume, Default dimension which is get populated during fixed creation from ur auto defaulting logic in asset table. so same thing you want to populate in asset Book, during value model setup.

    So you can populate or mapped the fixed asset default dimension in asset book table through init value method.

    \Forms\AssetBook\Data Sources\AssetBook\Methods\initValue

    assetTable = AssetTable::find(assetBook.AssetId);

    assetbook.defaultdimension = assettable.defaultdimension.

    Thanks

    Bhaskar

  • Suggested answer
    André Arnaud de Calavon Profile Picture
    301,141 Super User 2025 Season 2 on at

    Hi Ludwig,

    It is possible to customize it. We have done this for projects and workers about two months ago.

    You can add coding on the insert method (after super) or a post event handler.

    The next blog can help you understand how to change a single dimension value. You can change the dimension and the value to meet the Asset dimension and the asset.number as value.

    www.schweda.net/blog_ax.php

  • Verified answer
    jasman Profile Picture
    1,413 on at

    I meddled with this last night, and I got the system to assign the correct default dimension to assetTable with a customization like Andre suggests.

    *** Be aware however that the DefaultDimension field on AssetTable has a CountryRegionCode "LV" assigned to it, which means that it will only be used in a legal entity based in Latvia. ***

    I tried to change the CountryRegionCode to include my current legal entity, but I couldn't get it to use the default dimension in any of the asset-journals.

    Can I ask you to specify exactly in which process/processes you need to get the default dimension automatically ?

    ***Update:
    After reading Baskhars post I get the idea:

    1)
    In the AOT change the CountryRegionCodes property of the field DefaultDimension in AssetTable.
    assettable_5F00_defaultdimension.png

    2)
    Change the assetTable.insert()-method to look something like this (take notice of the //New code sections):

    public void insert(boolean _skipCreateBooks = false)
    {
        // New code
        DimensionAttribute  dimensionAttribute;
        ;
    
        if (AssetParameters::find().BarcodeEqualsAssetNumber)
        {
            this.Barcode = this.AssetId;
        }
    
        this.setNameAlias();
    
    
        super();
    
        // Newcode -->
        select firstOnly Name from dimensionAttribute
            where dimensionAttribute.BackingEntityTableId == 1165;
        this.DefaultDimension = AssetTable::createDefaultDimension([dimensionAttribute.Name],[this.AssetId],true);
        this.doUpdate();
        // Newcode <--
        
    
        if (! _skipCreateBooks)
        {
                this.createAssetBooksFromAssetGroup();
                this.createAssetDepBooksFromAssetGroup();
                this.createAssetDepBookBonusFromAssetGroup();
    
        }
    
    }

    3)
    In the AssetBook.Insert()-method add the line show with blue color:

    // <GEEU>
    #define.Monthly(12)
    #define.Quarterly(4)
    #define.HalfYearly(2)
    #define.Yearly(1)
    // </GEEU>
    public void insert()
    {
        AssetDepreciationProfileId  assetDepreciationProfileId;
        AssetBookMerge assetBookMerge;
    
        this.AssetGroup = this.assetTable().AssetGroup;
        this.SortingId  = this.assetTable().SortingId;
        this.SortingId2 = this.assetTable().SortingId2;
        this.SortingId3 = this.assetTable().SortingId3;
        this.DefaultDimension = this.assetTable().DefaultDimension;

    4)

    Add this method to AssetTable:

     static DimensionDefault createDefaultDimension(container _attr, container _value, boolean _createIfNotFound = true)
     {
         DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();
         DimensionDefault                               result;
         int                                                      i;
         DimensionAttribute                            dimensionAttribute;
         DimensionAttributeValue                   dimensionAttributeValue;
         //_attr is dimension name in table DimensionAttribute
         container               conAttr =   _attr;
         container               conValue = _value;
         str                     dimValue;
    
         for (i = 1; i <= conLen(conAttr); i++)
         {
             dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
    
             if (dimensionAttribute.RecId == 0)
             {
                 continue;
             }
    
             dimValue = conPeek(conValue,i);
    
             if (dimValue != "")
             {
                 // _createIfNotFound is "true". A dimensionAttributeValue record will be created if not found.
                 dimensionAttributeValue =
                         dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,_createIfNotFound);
    
                 // Add the dimensionAttibuteValue to the default dimension
                 valueSetStorage.addItem(dimensionAttributeValue);
             }
         }
         result = valueSetStorage.save();
         return result;
     } 
    

     Courtesy of:
    http://axvuongbao.blogspot.dk/2013/08/how-to-create-default-dimension-from-x.html
     


     Then I got it to default the dimension in the journals. :-)

  • Suggested answer
    5400 Profile Picture
    7,162 on at

    I want add one simple API which u can  use for default dimension population. See default dimension will be available on the basis of your accounting structure.

    So you can pass the value as string to API which will give you recid and you can mapped into asset table in insert method.

    \Classes\DMFDimensionHelper\generateDefaultDimension

    please use above api with required dimension value.

    Example:

    Like - dept-Cost-Project

    Value string - Dept_001-cost_0078-Prj_990

    Dimrecid - 66789XXX

  • André Arnaud de Calavon Profile Picture
    301,141 Super User 2025 Season 2 on at

    @Jacob,

    Thanks for playing around with the information. I was assuming Ludwig is referring of getting the default dimensions filled at the value model (AssetBook) where the field is not constrained with country/region ID's.

  • Verified answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Dear all,

    I am overwhelmed by the feedback that I got from all of you especially from Jacob who provided the solution to my problem but also from Andre and Bhaskar who provided valuable input and idea. Many thanks for your help! Very much appreciated :-)

    Cheers,

    Ludwig

    P.S. After doing some additional testing I found an alternative solution and would like to share it here in case somebody else runs into similar problems. What I did was

    1) Creating a new method "SetFDFA" in the assetbook table with the following code:

    private void SetFDFA()

    {

    #define.DimAttrName('FixedAsset')

    DimensionDefault dimdefault;

    dimdefault = AxdDimensionUtil::getDimensionAttributeValueSetId([1,DimensionAttribute::findByName(#DimAttrName).Name, this.AssetId]);

    this.DefaultDimension = dimdefault;

     

    this.doUpdate();

     

    }

    2) Adjust the insert method of the assetbook table with the following code at the end:

    this.SetFDFA();

     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans