Translate

Monday, September 22, 2014

Updating the value of existing dimesnions - Default dimension

Here is a code to update the value of particular dimensions for items

InventTable inventTable;

DimensionAttributeValueSetStorage dimStorage;

DimensionAttribute dimAttrOpDiv;

DimensionAttributeValue dimAttributeValue;

while select forUpdate inventTable

{

ttsBegin;

dimStorage = DimensionAttributeValueSetStorage::find(inventTable.DefaultDimension);

dimAttrOpDiv = DimensionAttribute::findByName("DIMENSION NAME);

dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttrOpDiv, 'VALUE', true, true);


dimStorage.addItem(dimAttributeValue);

inventTable.DefaultDimension = dimStorage.save();

inventTable.doUpdate();


ttsCommit;






}

}


Thursday, July 24, 2014

Code to check the current user have system administartor rights in AX X++ code

Hi,


Sometime before I was written a big statement to find out the System admin rights of current user. Later I realized about global function that will help us to find the same.


isSystemAdministrator(): will tell you the current user is having the admin rights or not.


if isSystemAdministrator() return true then the user is having system admin rights, else not a system admin.


Hope this helps you.
Prasn