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
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();
i need to add both project and main account at the same time;how can i handle that??
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
i need to add another dimension type of project ;is it possible??
please help
thanks but when i add this code ,i found that the project gets blank
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.
where i should add this code?? is it in initvalue() of form data source
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.
the highlighted line is blank as shown above which i add value in initvalue of SmaserviceOrderlineDS.please help.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,104 Most Valuable Professional
nmaenpaa 101,156