Notifications
Announcements
No record found.
Hi all,
I want to find(create if it does not exist yet) the financial dimension RecId that has specific dimension value/s (ex. Cost center - 010)
Does anyone know how can I achieve this?
Thanks in advance.
Regards,
Zoran
Hi Zoran,
Have you checked the dimension attribute value combination table?
That should hold your information.
Best regards,
Ludwig
Do you want Ledger Dimension or Default Dimension
For Ledger;
LedgerDimension = AxdDimensionUtil::getLedgerAccountId(ledgerDimensionsContainer);
or
LedgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(_defaultAccount, JournalTrans.DefaultDimension);
dynamicsax4u.wordpress.com/.../
For Default;
msdynamics.nevoitech.com/.../
And Lastly for complex company structures(container part)
community.dynamics.com/.../x-code-to-generate-ledger-dimension-based-on-the-company-accounting-structure
Hi Ludwig,
thank you for replying.
I am not sure if its enough to do a search only by the display value in the table you mentioned.
Problem is that I am not sure how many dimensions will the customer use in the system and i dont want to go through all dimensions and set them as empty. Also i did a test scenario and set a value on a project and checked the dimension value in sql (DimensionAttributeValueSet table) and the RecId is different than the one I have in the table you mentioned.
I see.
What do you need this information actually for?
I have a form with a CostCenter str lookup field.
Selecting a value from here I need to find(create if it doesnt exists yet) the dimension that holds only cost center value and merge it with a different default dimension.
DimensionDefault defaultDim,newDefaultDim; DimensionAttribute dimensionAttribute; DimensionAttributeValue dimensionAttributeValue; DimensionAttributeValueSetStorage dimensionStorage; ; defaultDim = mytable.Defaultdimension; dimensionAttribute = DimensionAttribute::findbyName("CostCenter");// or find(RecId) dimensionAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute, myDimValue/*newCostCenterValue*/,false,true); dimensionStorage = DimensionAttributeValueSetStorage::find(defaultDim); dimensionStorage.addItem(dimensionAttributeValue); newDefaultDim = dimensionStorage.save();
I didn't test it but it didn't look wrong.
Edit:Sorry, I'm writing from the editor. I updated the code.
Hi Ergun,
thank you for your reply.
The code you provided you cannot compile for reason that you can't pass a buffer of DimAttValue in the find DimensionAttributeValueSetStorage method where a RecId is expected and how do you get 'newValue' and what does it represent?
Sorry, I'm writing from the editor. I updated the code above. (myDimValue-->come from form field)
thank you I think this solves my problem.
Initial testing shows expected results.
this is 1 issue, if defaultDim already contains a value for the cost center it won't overwrite it with the value I select myDimValue. Only if there is no dimension defined it will do the merging.
Any suggestions?
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 664 Most Valuable Professional
André Arnaud de Cal... 522 Super User 2025 Season 2
Sohaib Cheema 303 User Group Leader