Search This Blog

Friday, June 15, 2012

AX2012 Apply Template for Product using X++


This following sample code used to get the Template based on the paremeter that was defined and apply that template for the released product.


//this methods is used to retrieve the Templata data based on the Parameter and returns the container of the templateData that will be used in apply template functionality.
private container getTemplateData()
{
    SysRecordTemplateTable  templateTable;
    SysRecordTmpTemplate  tmp;
    container  dataContainer,RecordTmplateData;
    ParameterLocationTable  parameterLocation;
    int i;
    ;
     parameterLocation = ParameterLocationTable   ::find("TestLocation");
    sysRecordTmpTemplate=null;
    if( parameterLocation  )
    {
        select templateTable where templateTable.table==tableNum(inventTable);
        dataContainer=templateTable.Data;
        for (i=conlen(dataContainer); i; i--)
        {
            [tmp.Description, tmp.DefaultRecord, tmp.Data, tmp.Details] = conpeek(dataContainer, i);
            if(tmp.Description== parameterLocation .ItemTemplate)
            {
                tmp.OrgDescription=tmp.Description;
                tmp.insert();
                RecordTmplateData=tmp.data;
            }
        }
    }
    return RecordTmplateData;
}

// apply the Template for the released Product to the company

private void applyTemplate()
{
    EcoResProductTemplateApplyManagerUtils utils;
    InventTable                            inventTable;
    container           recordTmpValues;

   // if Product is released to the company
    if (releaseProductToCompany)
    {
        inventTable = InventTable::Find("Item1");
        recordTmpValues=this.getTemplateData(_changeOrderProduct);
        utils = EcoResProductTemplateApplyManagerUtils::newDefault();
        utils.applyTemplate(
            recordTmpValues,
            inventTable.ItemId);
    }
}

Thursday, June 7, 2012

Ax2012 Create SSRS Report using Query and Display Methods of Table

Based on  requests from users, how to create the Report with Display methods, The following link will help you to create a simple report and deploy.

http://dynamicsaxgyan.wordpress.com/2011/08/19/learn-quick-first-ssrs-report-in-dynamics-ax-2012