9/18/2015

AX2012: How to delete AUC files?

Hi, 
I want to explain what is the AUC files, and how to delete these files.

What is that? Application User Cache - AUC
This is a cache, with application object, server aos doesnt know about this files. Offen we have problem during the development, and CIL, compile and synchro doenst help us? Try delete AUC files...

Where they are?
C:\Users\USERID\AppData\Local

You can delete all files with type "AUC Files"




After this, we need to restart AOS.

Regards;

9/17/2015

AX2012: How to creating a new Sales Order by copying existing. Copy one to one.

Hi,
I’m going to explain you how to create new Sales Order from existing. We will copy header and lines, and will be able to specify the number of copies.

Step 1.
Create own form with SalesTable data source, where users see which exist Sales Order will be copied, and can specify the numbers of copies. 




Step 2. 
On SalesTable, we will create a static method:

static boolean copySalesOrder(SalesTable _buffer, counter _counter)
{
    SalesTable  salesTable;
    Counter     i;
    boolean     ret;
    SalesLine   fromSL;
    SalesLine   toSL;

    salesTable.data(_buffer);

    
    if(_buffer.ProjId != "")
        {
            info("We cannot copy SO assigned to project");
            return false;
        }
    ttsBegin;

    for (i=1;i<=_counter;i++)

    {
    salesTable.SalesId = "";
    salesTable.RecId = 0;
    salesTable.SalesId = NumberSeq::newGetNum(SalesParameters::numRefSalesId()).num();
    salesTable.SalesStatus = SalesStatus::Backorder;
    salesTable.insert();

            while select fromSL where fromSL.SalesId == _buffer.SalesId
            {
            toSL.data(fromSL);
            toSL.SalesId = salesTable.SalesId;
            toSL.SalesStatus = SalesStatus::Backorder;
            toSL.InventTransId = "";
            toSL.InventTransIdReturn = "";
            toSL.RecId = 0;
            toSL.ProjTransId = "";
            toSL.RemainInventFinancial = 0;
            toSL.RemainInventPhysical = toSL.QtyOrdered;
            toSL.RemainSalesFinancial = 0;
            toSL.RemainSalesPhysical = toSL.SalesQty;
            toSL.insert();
            ret = true;
            }

     }

    ttsCommit;

    return ret;
}


Step 3.
Now we should programmed button on our form, which run our static method copySalesOrder on SalesLine. On command button we called method clicked(), where we should put:

void clicked(){    super();
    SalesTable::copySalesOrder(st_buff, NumberOfCopy.value());   
    element.close();
}
Step 4.


On our form, we need to initial a buffer. So we called a init()  method, ale write code (as you see on prtscr)

public void init(){    super();
    if(element.args() != null && element.args().record() != null && element.args().record().TableId == tableNum(SalesTable))    {        st_buff = element.args().record();    }
}

Step 5.
The last one, we need a create a MenuItemButton on SalesTableListPage, in properties point out MenuItem with our forms.



That's all. Now we can press button on the ListPage, fill number of copies, and press button. Static method copy our SalesOrder, one to one, with new sequence number.


Please, write to me, if you have any suggestion, and questions. 
mdaxdoctor@gmail.com

Regards;