Labels

Showing posts with label AX 2009. Show all posts
Showing posts with label AX 2009. Show all posts

Monday, January 20, 2014

Ledger Exchange adjustment Not calculated correctly

I would like to share a problem with dynamics AX exchange adjustment function.

Symptoms:
1. You run exchange adjustment in December period (any year)
2. But the result your ledger balance in company currency (MST) / Ledger balance in transaction currency is not equal to the December end exchange rate

Problem:
There is closing transaction exist for the year. Turn out the user run the year end closing (GL>Periodic>Fiscal year close>Opening transaction) prior the exchange adjustment in december  period.

Solutions:
1. Cancel the opening transactions : GL>Periodic>fiscal year close>Opening transaction and set "Balance accounts" to "Reset"

2. Rerun exchange adjustment
3. Rerun the opening transaction, this time choose per normal parameter "Balance accounts" set to "Closing>Opening"

Hope it helps :)

Cheers.

Wednesday, January 15, 2014

Copy user groups from one user to another X++

Hi All,

Below job can be used to copy user groups from one user to another.

Relevant for AX 2009, AX 4.0 and Axapta 3.0

static void AXEcopyUserGroup(Args _args)
{
    usergrouplist usergrouplist,ins;
    userid src,dest;
    dialogfield srcdf,destdf;
    dialog dialog;
    ;
    dialog = new dialog("copying user's user groups");
    srcdf = dialog.addField(typeid(userid),"Source");
    destdf = dialog.addField(typeid(userid),"Destination");
    

    
    if(dialog.run())
    {
        src = srcdf.value();
        dest = destdf.value();
        if(src!="" && dest !="")
        {
            ttsbegin;
            while select * from usergrouplist
            where usergrouplist.userId == dest
            {
                info(strfmt("Before update: '%1'-'%2'",usergrouplist.userid,usergrouplist.groupId));
            }
            
            info("Deleting user groups from destination user");
            delete_from usergrouplist
                where  usergrouplist.userId == dest;
                
                
            info("Copying user groups to destination user");
            while select * from usergrouplist
            where usergrouplist.userId == src
            {
                info(strfmt("source user: '%1'-'%2'",usergrouplist.userid,usergrouplist.groupId));
                ins.clear();
                ins.data(usergrouplist);
                ins.UserId = dest;
                ins.insert();
            }
            ttscommit;
            info("User groups has been copied!");
        }
    }
    else
    {
        info("Canceled by user");
    }
    
   
}