Sunday, December 8, 2013

How to release item using x++code in ax2012

How to release a item in Ax2012 through x++ code. Below code I have used in one of my requirement

public void releaseItem(DataAreaId     _dataAreaId)
{
    EcoResProduct   product;
    InventTable     inventTable;
    ;

    select firstOnly RecID from product
        where product.DisplayProductNumber == this.getItemId();

    if (product.RecId)
    {
        inventTable = inventTable::findByProductInCompany(product.RecId, _dataAreaId);
        if (!inventTable.RecId)
        {
            EcoResProductReleaseManagerBase::releaseProduct(product.RecId,CompanyInfo::findDataArea(_dataAreaId).RecId);
        }
    }

}

No comments:

Post a Comment