Hello,
I have a requirement where some dimensions should be automatically initialized when creating a record (from args)
I have a Contract form and then user opens new form and based on the contract Id, contract dimension should be filled

The issue is that I don't want Main account to be filled, the user should manually select it in this segmented entry control.
This is my code:
LedgerAccountContract ledgerAccountContract;
List valueContractList;
DimensionAttributeValueContract dimContract, dimBuilding;
parameters = PMCParameters::find();
contDimRecId = parameters.ContractDimensionAttribute;
buildingDimRecId = parameters.BuildingDimensionAttribute;
contractDimensionName = DimensionAttribute::find(contDimRecId).DimensionKeyColumnName;
buildingDimensionName = DimensionAttribute::find(buildingDimRecId).DimensionKeyColumnName;
ledgerAccountContract = new LedgerAccountContract();
valueContractList = new List(Types::Class);
if (_contract)
{
dimContract = new DimensionAttributeValueContract();
dimContract.parmName(contractDimensionName);
dimContract.parmValue(_contract);
valueContractList.addEnd(dimContract);
}
if (_buildingId)
{
dimBuilding = new DimensionAttributeValueContract();
dimBuilding.parmName(buildingDimensionName);
dimBuilding.parmValue(_buildingId);
valueContractList.addEnd(dimBuilding);
}
ledgerAccountContract.parmMainAccount('');
ledgerAccountContract.parmValues(valueContractList);
DimensionStorage dimStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(ledgerAccountContract);
return DimensionAttributeValueCombination::find(dimStorage.save()).RecId;
And it works when I provide some hard-coded Main account but when I don't, I get the error wrong use of a function.
Any ideas how can I achieve this?