Tuesday, April 30, 2013

AX2012 TFS online: "The path X is already mapped in workspace Y"

Trying to take advantage of Team Foundation Service online using AX2012 is often not straight forward. 
One problem pops up today related to "The path X already mapped in workspace Y" when trying to activate version control. The problem is related to cached workspace info.

Removing workspaces in VS2012 does not do the trick as the caching info that creates the problem resides somewhere else. Go to  C:\Users\<username>\AppData\Local\Microsoft\Team Foundation\3.0\Cache and look for the VersionControl.config. Clear the workspaces info there to solve the issue.

Thursday, April 18, 2013

Friday, April 12, 2013

How to get LedgerDimensionAccount value for a vendor account.

Use the getDynamicAccount method in DimensionStorage class!

DimensionStorage::getDynamicAccount(<vendorAccount>,enum2int(LedgerJournalACType::Vend));

Cheers~

Wednesday, April 03, 2013

AX2012 – Create default dimension with a set of dimension values

The following job will get a DimensionAttributeValueSet record ID base on the a set of dimension values.


static void DEV_CreateDefaultDimension(Args _args)
{
    DimensionAttributeValueSetStorage   valueSetStorage = new DimensionAttributeValueSetStorage();
    DimensionDefault                    result;  
   
    int                     i;
    DimensionAttribute      dimensionAttribute;
    DimensionAttributeValue dimensionAttributeValue;
   
    // Note that "Item" is not one of the default dimension,
    // but DimensionAttributeValueSetStorage will handle it gracefully
    container               conAttr = ["Department", "ExpensePurpose", "Item"];
    container               conValue = ["00000028", "Training", "1000"];  
    str                     dimValue;            
   
    for (i = 1; i <= conLen(conAttr); i++)
    {              
        dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
       
        if (dimensionAttribute.RecId == 0)
        {
            continue;
        }
       
        dimValue = conPeek(conValue,i);
       
        if (dimValue != "")
        {
            // The last parameter is "true". A dimensionAttributeValue record will be created if not found.
            dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
           
            // Add the dimensionAttibuteValue to the default dimension
            valueSetStorage.addItem(dimensionAttributeValue);
        }              
    }      
   
    result = valueSetStorage.save();  
}

** The above is for interest only and comes with no warranties **