How to add new action under Context menu in Dynamics AX

Each node in the AOT contains a set of available actions. You can access these actions from the
context menu, which you can open by right-clicking any node.
You can create custom actions for any element in the AOT by enlist a class as a new add-in by following:
1. Create a new menu item and give it a meaningful name, a label, and Help text.
2. Set the menu item’s Object Type property to Class.
3. Set the menu item’s Object property to the name of the class to be invoked by the add-in.
4. Drag the menu item to the SysContextMenu menu.
5. If you want the action available only for certain nodes, you need to modify the verifyItem
method on the SysContextMenu class.

Common prefixes in Microsoft Dynamics AX

Prefix Description
As Microsoft Dynamics AX typed data source
Axd Microsoft Dynamics AX business document
Asset Asset Asset management
BOM Bill of material
COS Cost accounting
Cust Customer Customer
Dir Directory, global address
EcoRes Economic resources
Human resources Human resources
Invent Inventory management
JMG Shop floor control
KM knowledge management
Ledger General Ledger
PBA Product builder
Prod Production
Proj Project
Purch Purchase
Req Requirements
Sales Sales
SMA Service management
SMM Sales and marketing management also called customer relationship management (CRM)
Sys Application frameworks and development tools
Tax Tax engine
Vend Vendor
Web Web framework
WMS Warehouse management

How to add new action under Context menu in Dynamics AX

Each node in the AOT contains a set of available actions. You can access these actions from the
context menu, which you can open by right-clicking any node.
You can create custom actions for any element in the AOT by enlist a class as a new add-in by following:
1. Create a new menu item and give it a meaningful name, a label, and Help text.
2. Set the menu item’s Object Type property to Class.
3. Set the menu item’s Object property to the name of the class to be invoked by the add-in.
4. Drag the menu item to the SysContextMenu menu.
5. If you want the action available only for certain nodes, you need to modify the verifyItem
method on the SysContextMenu class.

Microsoft Dynamics 365: What You Need to Know

In July 2016, Microsoft announced it would be combining its CRM and ERP solutions into a single cloud-based bundle called Microsoft Dynamics 365. The announcement raised many questions among users about whether it will replace current Microsoft products and how users can implement these solutions.
One thing is clear, though – Dynamics 365 enables employees to work from anywhere at any time through their mobile devices, and Microsoft believes this will be a game changer for its customers. Read on to learn more about Dynamics 365 and mobility.

Microsoft’s New Approach to Business Applications

Microsoft has billed Dynamics 365 as “the next generation of intelligent business applications” that “enable organizations to grow, evolve, and transform.” But, what does that mean in practice?
According to Microsoft spokespeople, Dynamics 365 is a re-architecting and repackaging of the capabilities of Dynamics CRM, Dynamics AX, and a small business SaaS offering called “Project Madeira.” Furthermore, Dynamics 365 complements Microsoft’s current lineup of CRM and ERP solutions (the existing ERP systems will not go away). And, it will connect to Office 365, making it simple for users to communicate, share, and request information from within one platform.

A New Licensing Model

Microsoft offers two licensing models for Dynamics 365: an application-based model and a role-based model.
Under the application-based model, businesses can purchase as many apps as they need, even if it’s only a single app. Conversely, the role-based model enables employees to access mission-critical apps. For example, a salesperson doesn’t just need to use a CRM app. He or she also needs data from field service representatives and the customer service team. The information from those app categories allows the salesperson to not merely do his or her job, but excel at it.

What People Are Saying about Dynamics 365

The Dynamics 365 announcement attracted a great deal of attention from industry analysts. They note that it represents a new approach to CRM and ERP applications from the software giant.

Walkthrough: Creating a Workflow Template AX 2009

In Microsoft Dynamics AX, you define a workflow by creating a template to base the workflow on. In this walkthrough, you will create a workflow template in the Application Object Tree (AOT) that you can add approvals and tasks to.
A workflow template defines information about:
  • Which workflow document to use. The workflow document exposes calculated fields and identifies the query that exposes data fields for the workflow.
  • Tasks and approvals that can be configured by the end user.
  • Workflow categories used for assigning a workflow template to a specific module.
  • Menu items and event handlers.
This walkthrough illustrates the following tasks:
  • Create a workflow template in the AOT.
  • Create a query to expose data for conditions.
  • Create a workflow document class to identify the query and calculated fields.
  • Bind the query to the workflow document class.
  • Bind the workflow document class to the workflow template.
  • Create a workflow category.
  • Bind the workflow category to the workflow template.
  • Create a SubmitToWorkflow menu item.
  • Bind the workflow menu item to the workflow template.
  • Set a license configuration key for the workflow template.

Prerequisites

To complete this walkthrough, you will need:
  • Microsoft Dynamics AX
  • A license file that has access to the MorphX development environment
To create a workflow template in the AOT
  1. In the AOT, expand the Workflow node.
  2. Right-click the Workflow Templates node, and then select New Workflow Template. A workflow template group displays under the Workflow Template node.
  3. Right-click the new workflow template and then click Properties.
  4. In the Properties sheet, set the Name property to MyWorkflowTemplate.
  5. In the AOT, right-click MyWorkflowTemplate, and then click Save.
After the workflow template is created, you can create the objects that you need to bind to the workflow template. For this walkthrough, the next step is to create a query to identify the table data fields used for the workflow document.

for complete Article click here

How to Delete Company Transactions in AX 2012 including Trial balance?

To delete Transactions data inside any company in ax, you can do by using the class SysDatabaseTransDelete under AOT.
But you may facing an issue since the Trial Balance will not be deleted so, to delete GL Trans by deleting the following tables:
GeneralJournalAccountEntry
GeneralJournalEntry
LedgerEntryJournal
LedgerEntry
Ledgerjournaltrans
Ledgerjournaltable
To remove the Trial Balance you have to follow the steps below:


1-) Modify 'handleTable()' method by adding 2 new cases
Case TableGroup::TransactionHeader:
Case TableGroup::TransactionLine:
void handleTable(SysDictTable sysDictTable)
{
    TableGroup      tableGroup;

    if (tableSet.in(sysDictTable.id()))
        return;

    tableSet.add(sysDictTable.id()); 

    if (sysDictTable && !sysDictTable.isTmp() && !sysDictTable.isMap())
    {
        tableGroup = sysDictTable.tableGroup();
        // Handle company specific tables to be deleted
        if (sysDictTable.dataPrCompany())
        {
            switch(tableGroup)
            {
                case TableGroup::Transaction:
                case TableGroup::TransactionHeader:
                case TableGroup::TransactionLine:
                case TableGroup::WorksheetHeader:
                case TableGroup::WorksheetLine:
                    this.handleTransTable(sysDictTable);
                    break;
                default:
                    this.handleNonTransTable(sysDictTable);
                    break;
            }
        }
        else
        {
            // Handle global tables to be deleted
            switch(tableGroup)
            {
                case TableGroup::Transaction:
                case TableGroup::TransactionHeader:
                case TableGroup::TransactionLine:
                case TableGroup::TransactionHeader :
                case TableGroup::WorksheetHeader:
                case TableGroup::WorksheetLine:
                    this.handleGlobalTransTable(sysDictTable);
                    break;
                default:
                    break;
            }
        }
    }
}

2) Add a new method to handle LEDGERJOURNALTABLE:
private void deleteLedgerJournalTables()
{
    GeneralJournalEntry         GJEntry;
    GeneralJournalAccountEntry  GJAEntry;
    LedgerJournalTable          ledgerjournalTable;
    LedgerEntryJournal          ledgerEntryJournal;

    ttsBegin;
    while select forupdate LedgerJournalTable
    {
        while select forUpdate ledgerEntryJournal
            where ledgerEntryJournal.JournalNumber == ledgerjournalTable.JournalNum
            //&&    ledgerEntryJournal.dataAreaId == ledgerjournalTable.dataAreaId
        {
            while select forUpdate GJEntry
                where GJEntry.LedgerEntryJournal == ledgerEntryJournal.RecId
            {
                  delete_from GJAEntry  where GJAEntry.GeneralJournalEntry == GJEntry.RecId;

                GJEntry.delete();
            }
            ledgerEntryJournal.delete();
        }
        LedgerJournalTable.delete();
    }
    ttsCommit;
}


3) Modify the 'handleTransTable()' method to call the above method
void handleTransTable(SysDictTable sysDictTable)
{
    switch(sysDictTable.id())
    {
        case tablenum(CustCollectionLetterLine):
        case tablenum(InventDim):
        case tablenum(DocuRef):
        case tablenum(DirPartyRelationship) :

            break;
        case tablenum(LedgerJournalTable) :
            this.deleteLedgerJournalTables();
            break;

        default:
            this.deleteTable(sysDictTable);
            break;
    }
}

4) You may have to modify the 'deleteVoucher()' method in the 'LedgerJournalTrans' table to skip over releasing non-existing voucher numbers
public server void deleteVoucher(Voucher _voucher = this.Voucher)
{
    LedgerJournalTable  ledgerJournalTable = LedgerJournalTable::find(this.JournalNum);

    if (! ledgerJournalTable.Posted && !this.Transferred)
    {
        if (_voucher && ! LedgerJournalTrans::existTransMinusThis(this.JournalNum, _voucher, this.RecId))
        {
            if (this.checkVoucherNotUsed(ledgerJournalTable, _voucher))
            {
                if (this.checkVoucherNotUsedDataSource(_voucher))
                {
                    // replace the voucher number so it can be re-used
                    if (ledgerJournalTable.NumberSequenceTable) /* 28Nov12-Admin */
                        NumberSeq::releaseNumber(ledgerJournalTable.NumberSequenceTable, _voucher);

                    if (this.Voucher == _voucher)
                    {
                        // delete voucher template record if exists and the voucher on the line is not being changed
                        LedgerJournalTransVoucherTemplate::deleteForJournalOrVoucher(this.JournalNum, _voucher);
                    }
                }
            }
        }
    }
}
5) After running 'SysDatabaseTransDelete', rebuild balances for the financial dimension sets (General Ledger\Setup\Financial Dimensions\Financial dimension sets)

If you still have non-zero amounts in the Trial balance then you must manually remove the 'left-over' rows in the shared tables (results of your previous executions of the 'SysDatabaseTransDelete'). Identify these entries in the 'LedgerEntryJournal' table then use the following job to clear them:
static void tg_deleteTables(Args _args)
{
    GeneralJournalEntry         GJEntry;
    GeneralJournalAccountEntry  GJAEntry;
    LedgerJournalTable          ledgerjournalTable;
    LedgerEntryJournal          ledgerEntryJournal;

    ttsBegin;
        while select forUpdate ledgerEntryJournal
            where ledgerEntryJournal.JournalNumber like 'clau*'  
        {
            while select forUpdate GJEntry
                where GJEntry.LedgerEntryJournal == ledgerEntryJournal.RecId
            {
                  delete_from GJAEntry  where GJAEntry.GeneralJournalEntry == GJEntry.RecId;

                GJEntry.delete();
            }
            ledgerEntryJournal.delete();
        }

    ttsCommit;
    info('completed');
}