Sunday, February 3, 2013

Remove marked for settlement open transactions through X++ code

Due to the interesting way that AX settles marked transactions (see previous post:, it can be required to unmark all currently marked open transactions before marking a new set of transactions and doing an auto-settlement process. If this un-marking of transactions did not occur, certain credits or debits could be settled against unintended transactions because of a true lacking of 3-way matching functionality. Yes we can mod the system to do this (and I have...) but this post has nothing to do with that. But I digress...

In order to un-mark transactions that were previously marked via X++, use the code below:

CustVendOpenTransManager manager;
Common                   originator;

// Set the originator code from a record. 
originator = element.args().record(); 

manager = CustVendOpenTransManager::construct(originator); 

// If there are marked transactions, clear them
if (manager.getSpecTransCount() > 0)

Obviously the code above shows some flexibility using the common and loading the framework from different forms. If you just want to clear out a customer's marked transactions in a quick way, you can use the code below and simple replace the customer number with the one you are interested in clearing out. Easy enough.

static void unmarkAllTransByCustomer(Args _args)
    CustTable                custTable = CustTable::find('C00023567');
    CustVendOpenTransManager manager = CustVendOpenTransManager::construct(custTable);
    if (manager.getSpecTransCount() > 0)


  1. is there any way to know who (user) is currently marking the transactions?

    1. There is but I don't believe there is anything from a functional standpoint to help indicate who is using that record out of the box. It's been a while since I've seen the screen but I believe it was a modification (not a big one).

      It was helpful for a few clients I had when stepping on toes in the matching process was sometimes an issue.

    2. Hi Justin! Can you please give me a hint about that modification ( about the user who marked the transaction ) ?

    3. The mod was from AX 4.0 and upgraded to 2009. From what I recall, it had a physical field added to the marking transaction table. I don't remember the specific table names but there was a link created when a transaction is marked. In 2012, you should be able to use the 'modified by' field on the table/field when the record is created. You'll then need to add it to the form so the end users can see who marked it. It's literally been 6 years since I did this last so the above may not make any sense but its what I remember :-) For what its worth.