Sunday, March 6, 2016

Dimension Create Default Dimension

DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
    DimensionDefault result;
    int i;
    DimensionAttribute dimensionAttribute;
    DimensionAttributeValue dimensionAttributeValue;
    container conAttr = ["BusinessUnit","Department" ,"Project"];
    container conValue;
    str dimValue;
conValue = ["", "", reqLine.ProjId];
            dimValue = "";
            i = 0;
            for (i = 1; i <= conLen(conAttr); i++)
            {
                dimensionAttribute = dimensionAttribute::findByName(conPeek(conAttr,i));
                if (dimensionAttribute.RecId == 0)
                {
                    continue;
                }
                dimValue = conPeek(conValue,i);
                if (dimValue != "")
                {
                    dimensionAttributeValue =
                    dimensionAttributeValue::findByDimensionAttributeAndValue(dimensionAttribute,dimValue,false,true);
                    valueSetStorage.addItem(dimensionAttributeValue);
                }
            }
            result = valueSetStorage.save();

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...