Hallo,
i want to disable MainAccount in financial dimension Purchase requisitions Line,
but its error Object reference not set to an instance of an object., need advise for my case how can i solve ?
my reference to link :
https://d365dev.com/2018/04/20/disable-editing-of-specific-financial-dimensions-on-form/
i just change event handler to
[FormEventHandler(formStr(PurchReqTable), FormEventType::Initialized)]
public static void PurchReqTable_OnInitialized(xFormRun sender, FormEventArgs e)
{
DimensionEntryControl dimControl = _sender.design().controlName(identifierStr(DimensionEntryControlTable));
DimensionEnumeration dimensionSetId = DimensionCache::getDimensionAttributeSetForLedger();
DimensionAttributeSetStorage dimensionAttributeSetStorage;
DimensionAttribute dimensionAttribute;
DimensionAttributeSetItem dimAttrSetItem;
const str MainAccounttmp = 'MainAccount';
dimensionAttributeSetStorage = new DimensionAttributeSetStorage();
while select dimensionAttribute
where dimensionAttribute.Name != MainAccounttmp // Exclude specific dimension which should be not editable
join dimAttrSetItem
where dimAttrSetItem.DimensionAttribute == dimensionAttribute.RecId
&& dimAttrSetItem.DimensionAttributeSet == dimensionSetId
{
dimensionAttributeSetStorage.addItem(
dimensionAttribute.RecId,
dimensionAttribute.HashKey,
NoYes::Yes);
}
dimControl.parmEditableDimensionSet(dimensionAttributeSetStorage.save());
}
Thanks


Report
All responses (
Answers (