dynamics 365 etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
dynamics 365 etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

27 Kasım 2021 Cumartesi

Dynamics 365 F&O - If debugger begin jump meanless this would be about an endless recursive call

 I wrote an endless recursive call with AX 2012 accidentally. When I run my code I suspected an endless loop and tried to debug. Debugger was jumping from there by a confusing way over there in code meanless. I did a bit of google and found this would be about an endless recursive call.

When I lived same situation with 365 F&O two days ago it was so surprising for me. With all new compiled base in Visual Studio debugger I wouldn't expect this strange behaviour again. This time it was a bit different but same behaviour again (In 2009 it was going irrelevant code lines in every hit, this time in one point it was going irrelevant code again but after that begun an endless loop without a loop). This time I remembered what I lived with in 2009, so I fixed it fast.

At the end I mean if your debugger goes irrelevant code, -doesn't matter if 2009, 2012 or 365 F&O- you would be written an endless recursive call (Or your colleague would do a test in your DEV machine).


20 Ağustos 2021 Cuma

Dynamics 365 F&O - Extend decimal point beyond five

 Dynamics 365 F&O supports six decimal points. So just extend decimal point field  of extended data type doesn't enough:

 

 

We need to do a few tricks more:

In first we create a new field for save decimal point and be sure this method below to run after every write (We can call from update/insert methods).

  public void updateInterestRateDecimals()
    {
        this.InterestRateDecimal = (this.InterestRate - real2int(this.InterestRate) ) *
            100000000;
    }

 

Than we modify postLoad like this:

public void postLoad()
    {
        super();
        if (this.InterestRateDecimal != 0)
        {
            this.InterestRate = real2int(this.InterestRate) +
                this.InterestRateDecimal / 100000000;
        }
    }

 

Result:


 

 

4 Mart 2021 Perşembe

AX 2012/365 F&O - Settle customer/vendor transactions

   public static void settlement(CustVendTransOpen _trans1,CustVendTransOpen _trans2,
        CustVendACType _type = CustVendACType::Vend)
    {
        CustVendOpenTransManager manager;

        if (_type == CustVendACType::Vend)
            manager = CustVendOpenTransManager::construct(VendTable::find(_trans1.AccountNum));
        else
            manager = CustVendOpenTransManager::construct(CustTable::find(_trans1.AccountNum));
        manager.updateTransMarked(_trans1, true);
        manager.updateTransMarked(_trans2, true);
        manager.settleMarkedTrans();
    }

26 Ocak 2021 Salı

AX 2012 - Send filter with args

 

If your filter just one record, you can run filter with args.record(). In the other case if you have to filter more than one record, you can't use record method. You can use InitialQueryParameter for this:

            Args                 args = new Args();
            MenuFunction         MenuFunction = new MenuFunction('LedgerJournalTable', MenuItemType::Display);
            Query                q = new Query();
            QueryBuildDataSource QBDS = q.addDataSource(tableNum(LedgerJournalTable));

            if (ABCRCreditTable.AccualJournalNum != "")
                QBDS.addRange(fieldNum(LedgerJournalTable,JournalNum)).value(ABCRCreditTable.AccualJournalNum);
            if (ABCRCreditTable.AccualJournalNum2 != "")
                QBDS.addRange(fieldNum(LedgerJournalTable,JournalNum)).value(ABCRCreditTable.AccualJournalNum2);

            args.initialQuery(InitialQueryParameter::createByQuery(q));
            args.caller(this);

            MenuFunction.run(args);