最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

使用X ++ 为Dynamics 365财务和运营客户/供应商添加财务维度 / Add Financial dimension to Customer/Vender with X++ Dynamics 365 for finance and operations

网络文摘 alirazazaidi 1176浏览 0评论
Small tip, I used following code snippet to add financial dimension in Customer / Vendor, You can extend this code by adding more dimension and values on Containers in following code snippet.
public class  iaxFinancialDimensionHelper
{
    Public static DimensionDefault ProjectDimension(ProjId _ProjId)
    {
        DimensionAttributeValueSetStorage valueSetStorage = new DimensionAttributeValueSetStorage();
        DimensionDefault result;
        int i;
        DimensionAttribute dimensionAttribute;
        DimensionAttributeValue dimensionAttributeValue;
        container conAttr = [“Projects”];
        container conValue = [_ProjId];
        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();
        return result;
    }
}
Reference : Internet. possible Dynamics forum. it works for me.
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址