Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Display only a single financial Dimension

(0) ShareShare
ReportReport
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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,468 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,289 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans