Friday, February 24, 2012

Financials basic training

Again, another useful information shared by Dynamics AX Training team related to financials basic training. here is the link:

Thursday, February 2, 2012

Release products to the legal entities using X++

In this post, I would like to share X++ Code that will help to release products to the legal entities from product master.

static void releaseProducts_Job(Args _args)
    EcoResProduct ecoResProduct;
    InventTable inventTable;
    InventTableModule inventTableModule;
    NumberSequenceTable numberSequenceTable;
    ItemId itemId;
    InventItemSetupSupplyType inventItemSetupSupplyType;

    EcoResStorageDimensionGroupProduct ecoResStorageDimensionGroupProduct;
    EcoResTrackingDimensionGroupProduct ecoResTrackingDimensionGroupProduct;
    EcoResStorageDimensionGroupItem ecoResStorageDimensionGroupItem;
    EcoResTrackingDimensionGroupItem ecoResTrackingDimensionGroupItem;

    select firstOnly ecoResProduct where EcoResProduct.DisplayProductNumber == "test"; //Audio system

    changecompany ('CEU')
        inventTable = null;
        inventTableModule = null;
        inventItemSetupSupplyType = null;
        ecoResStorageDimensionGroupProduct = null;
        ecoResTrackingDimensionGroupProduct = null;
        ecoResStorageDimensionGroupItem = null;
        ecoResTrackingDimensionGroupItem = null;

        numberSequenceTable = InventParameters::numRefItemId().numberSequenceTable();
        //get item id from:
        //1. Product number if number seq for item ID is not set up or manual or return blank value
        if (!numberSequenceTable.RecId || numberSequenceTable.Manual)
            itemId = ecoResProduct.productNumber();
        else //number sequence auto, get a number
            itemId = NumberSeq::newGetNumFromId(numberSequenceTable.RecId).num();

        inventTable.ItemId = ItemId;
        inventTable.NameAlias = ecoResProduct.SearchName;

        // Create inventTableModules

        inventTableModule.ItemId = inventTable.ItemId;
        inventTableModule.ModuleType = ModuleInventPurchSales::Invent;

        inventTableModule.ItemId = inventTable.ItemId;
        inventTableModule.ModuleType = ModuleInventPurchSales::Purch;

        inventTableModule.ItemId = inventTable.ItemId;
        inventTableModule.ModuleType = ModuleInventPurchSales::Sales;

        //Create inventItemLocation

        // Creates a new item default order type for the product that is released.

        inventItemSetupSupplyType.ItemId = inventTable.ItemId;
        inventItemSetupSupplyType.ItemDataAreaId = inventTable.DataAreaId;

        //create relationship tables to dimension groups.

        ecoResStorageDimensionGroupProduct = EcoResStorageDimensionGroupProduct::findByProduct(ecoResProduct.RecId);
        ecoResTrackingDimensionGroupProduct = EcoResTrackingDimensionGroupProduct::findByProduct(ecoResProduct.RecId);

        if (ecoResStorageDimensionGroupProduct.RecId)
            // mandatory storage dimension group for the product
            ecoResStorageDimensionGroupItem.ItemDataAreaId = inventTable.DataAreaId;
            ecoResStorageDimensionGroupItem.ItemId = inventTable.ItemId;
            ecoResStorageDimensionGroupItem.StorageDimensionGroup = ecoResStorageDimensionGroupProduct.StorageDimensionGroup;

        if (ecoResTrackingDimensionGroupProduct.RecId)
            // mandatory tracking dimension group for the product
            ecoResTrackingDimensionGroupItem.ItemDataAreaId = inventTable.DataAreaId;
            ecoResTrackingDimensionGroupItem.ItemId = inventTable.ItemId;
            ecoResTrackingDimensionGroupItem.TrackingDimensionGroup = ecoResTrackingDimensionGroupProduct.TrackingDimensionGroup;
        info("Product successfully released to CEU legal entity");

Wednesday, February 1, 2012

Logon failed for the unattended execution account

Following are steps that need to be performed if you start getting login failed for unattended execution account error.

“An error occurred during client rendering.
 The report server has encountered a configuration error. Logon failed for the unattended execution account
 Logon failed (rsLogonFailed) Logon failure: unknown user name or bad password.”

If this happens then it means there are unattended execution account was configured and there is some problem with the account mentioned in the configurations. Either it has changed in Active Directory setup and the password has been expired or changed. This is optional setting but if you have configured it then it must be updated when there is change in the account information or password. Otherwise you may start getting the aforementioned error message.

 To configure the account:

 Launch the reporting services configuration manager and connect to the report server.

  1. Go to Execution Account and select the Specify an execution account checkbox.
  2. Enter the account information and click on Apply button. This must be the domain account.
Go to the report manager and access the reports and it should now run properly.