Friday, 8 March 2024

How to make one of the Financial dimension value as read only using x++

On Form initializes

    public void init()

    {

        DimensionAttribute              dimAttr;

        DimensionAttributeSetStorage    dimStorage;

        DimensionEnumeration            editableDimensionSet;

 

        next init();

 

        dimStorage = new DimensionAttributeSetStorage();

   

        while select HashKey, RecId from dimAttr

            where dimAttr.Type != DimensionAttributeType::DynamicAccount

            &&    dimAttr.Type != DimensionAttributeType::MainAccount

            &&    dimAttr.Name != "Business Unit"

        {

            dimStorage.addItem(dimAttr.RecId, dimAttr.HashKey, NoYes::Yes);

        }

 

        editableDimensionSet = dimStorage.save();

 

        //Make Business unit Read only

        if(editableDimensionSet)

        {

            DimensionEntryControlTable.parmEditableDimensionSet(editableDimensionSet);

            DimensionEntryControlTable.allowEdit(true);

        }

    }

 








Note:

DimensionEntryControlTable = Dimension Entry control