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

D365: Get dimension value owner name in X++

网络文摘 William 27浏览 0评论

Purpose:

Demonstrate how can we get the dimension value owner name in X++.

Application:

Dynamics 365 for Finance and Operations

Business requirement:

Business requirement is to display cost center owner name in a report.

Solution:

We can use the code below to get the cost center dimension value owner in X++.

Code

/// <summary>
/// Get dimension value owner Feb 16, 24 MK
/// </summary>
/// <remarks>
/// Atlas Dynamics Pty Ltd.
/// </remarks>
public RefRecId getDimensionAttributeValueOwner(Name _dimAttrName, DimensionDisplayValue _dimAttrValue)
{
	DimensionAttribute dimAttribute;
	DimensionAttributeValue dimAttributeValue;

	dimAttribute = DimensionAttribute::findByName(_dimAttrName);
	dimAttributeValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttribute, _dimAttrValue);

	return dimAttributeValue.Owner;
}

We can then call this method in the following way to initialize the temp table buffer.

hcmWorker = HcmWorker::find(this.getDimensionAttributeValueOwner(#CostCenter, purchOrderLineTmp.DimensionCostCenter));
purchOrderLineTmp.DimOwner = hcmWorker.PersonnelNumber;
purchOrderLineTmp.DimOwnerName = hcmWorker.name();

发表我的评论
取消评论

表情

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

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