Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Display only a single financial Dimension

Posted on by Microsoft Employee

Hello

when I create a PurchOrder the standard way using the PurchCreateOrder - Form I want to add a field showing the cost center of a selected ProjectId on that Form.

How can I reach that?

*This post is locked for comments

  • Suggested answer
    Chaitanya Golla Profile Picture
    Chaitanya Golla 17,225 on at
    RE: Display only a single financial Dimension

    Hi,

    On form PurchCreateOrder, created a new string field and fill it up based on the projectId selected on the form.
    Perform following steps:
    1. Create a string field on the form and set property autoDeclaration to Yes.

    CreatePurch.jpg
    2. Create a new method under the datasource PurchTable by name costCenter and use following code.
    Path: \Forms\PurchCreateOrder\Data Sources\PurchTable\Methods\costCenter

    public DimensionValue costCenter()
    {
        ProjTable                       projTable;
        DimensionAttributeValueSetItem  dimensionAttributeValueSetItem;
        DimensionAttributeValue         dimensionAttributeValue;
        DimensionAttribute              dimensionAttribute;
        
        select RecId from projTable
            where projTable.ProjId == PurchTable.ProjId
            join RecId, DisplayValue from dimensionAttributeValueSetItem
            where dimensionAttributeValueSetItem.DimensionAttributeValueSet == projTable.DefaultDimension
            join RecId from dimensionAttributeValue
                where dimensionAttributeValue.RecId == dimensionAttributeValueSetItem.DimensionAttributeValue
                join RecId, Name from dimensionAttribute
                    where dimensionAttribute.RecId == dimensionAttributeValue.DimensionAttribute
                    && dimensionAttribute.Name == "CostCenter"; 
        
        return dimensionAttributeValueSetItem.DisplayValue;
    }

    3. On the modified method of field ProjId on the datasource, add below code

    Path: \Forms\PurchCreateOrder\Data Sources\PurchTable\Fields\ProjId\Methods\modified

    public void modified()
    {
        super();
        
        CostCenter.text(PurchTable_ds.costCenter());   
    }


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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans