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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

how to add default main account in financial dimension on Service management model AX

(0) ShareShare
ReportReport
Posted on by 10,280

please anybody tell me what class i use to add default main account value inside the form of service order AX 2012

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Mea_ Profile Picture
    60,286 on at

    DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();

    DimensionAttribute      dimensionAttribute = dimensionAttribute::findByName("Main_Account");

    DimensionAttribute      dimensionAttributeProject = dimensionAttribute::findByName("Project");

    DimensionAttributeValue dimensionAttributeValue = dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, "Your account number",false,true);

    DimensionAttributeValue dimensionAttributeValueProject = dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttributeProject, "Your project",false,true);

    valueSetStorage.addItem(dimensionAttributeValue);

    valueSetStorage.addItem(dimensionAttributeProject );

    defaultDimension = valueSetStorage.save();

  • Codehunter Profile Picture
    10,280 on at

    i need to add both project and main account at the same time;how can i handle that??

  • Suggested answer
    Saju Kanakaraj Profile Picture
    605 on at

    Can you paste your code here.

    Also explain what you are trying to do.

    Do you have project dimension in your active dimension list? If no, Ask functional to add project dimension. As per my understanding you need to initialize the dimension value when you create new record. I would suggest you to create new default dimension field in parameter form & assign the dimension value in init value of the datasource or table as below.

    void initvalue()

    {

    datasource.newdimension = ParametersTable::find().defaultdimension;

    }

    Please refer the link to add new dimension field in form.

    mukesh-ax.blogspot.in/.../how-add-financial-dimension-on-forms.html

  • Codehunter Profile Picture
    10,280 on at

    i need to add another dimension type of project ;is it possible??

  • Codehunter Profile Picture
    10,280 on at

    please help

  • Codehunter Profile Picture
    10,280 on at

    thanks but when i add this code ,i found that the project gets blank

  • Suggested answer
    Saju Kanakaraj Profile Picture
    605 on at

    If the value should be defaulted when create new record, You can write it in two places.

    1. Form data source initvalue

    2. Table initvalue method.

    Still it is depends upon the criteria.

    If you want to default any value from the form arguments. Then it should be done at the form datasource level.

  • Codehunter Profile Picture
    10,280 on at

    where i should add this code?? is it in initvalue() of form data source

  • Mea_ Profile Picture
    60,286 on at

    Because it is not ledger Dimensions it is DefaultDimensions.  

    Here you go

    DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();
    
     DimensionAttribute      dimensionAttribute = dimensionAttribute::findByName("Main_Account");
     DimensionAttributeValue dimensionAttributeValue = dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, "Your account number",false,true);
    
    valueSetStorage.addItem(dimensionAttributeValue);
    
    defaultDimension = valueSetStorage.save();  

    Using this code you can create new DefaultDimension.

  • Codehunter Profile Picture
    10,280 on at

    the highlighted line is blank as shown above which i add value in initvalue of SmaserviceOrderlineDS.please help.

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

News and Announcements

Season of Giving Solutions is Here!

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
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Volodya Profile Picture

Volodya 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans