web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Data Migration Making COC of a method of dynamics ax 2012

(0) ShareShare
ReportReport
Posted on by 3,110

Hi Experts,

How can i make Chain of Commands of the below code this is dynamics ax 2012 code:-

 public void activate(boolean _active)
{
super(_active);

if (purchParmUpdate.CustomsImportOrderType_IN != CustomsImportOrderType_IN::ImportOrder)
{
specQty.delete("@GLS5652");
}
// Added  --> start
select purchTable
where purchTable.PurchId == purchParmTable.PurchId;
if(purchTable.DocumentState == VersioningDocumentState::Confirmed && purchTable.PurchStatus == PurchStatus::Backorder)
{
PurchParmTable_TransDate.allowEdit(false);
//PurchParmTable_TransDate.allowEdit(true);
}
// Added by J9074 on 22-03-2019 --> end
//Added by Pavan 01-10-2020 for T17862 - GRN that if it is import order then only BOE option should be allowed to selected for Invoicing the PO
if(PurchParmTable.purchTable().purchTable_W().CustomsImportOrder_IN == NoYes::Yes)// && documentStatus == DocumentStatus::PackingSlip)
{
if(PurchParmUpdate.SpecQty == PurchUpdate::BillOfEntryQuantity_IN)
{
PurchParmUpdate_ds.object(fieldNum(PurchParmUpdate, Specqty)).allowEdit(false);
}
}
//end
}

//Added by Pavan 01-10-2020 for T17862 - GRN that if it is import order then only BOE option should be allowed to selected for Invoicing the PO
if(PurchParmTable.purchTable().purchTable_W().CustomsImportOrder_IN == NoYes::Yes)// && documentStatus == DocumentStatus::PackingSlip)
{
if(PurchParmUpdate.SpecQty == PurchUpdate::BillOfEntryQuantity_IN)
{
PurchParmUpdate_ds.object(fieldNum(PurchParmUpdate, Specqty)).allowEdit(false);
}
}
//end

Best Regards,

Shabir Ahmad

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,833 Moderator on at

    Hi Shabir,

    Seems this is form level activate method. You can write either COC for form level or use event handler "OnActivated" method.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi You can try below method, create form extension class. The code is just for reference on how it can be done and not compiled.

    public void activate(boolean _active)
    {
        next activate(_active);
        FormDataSource PurchParmUpdate_ds = this.datasource(IdentifierStr(PurchParmUpdate)); 
        PurchParmUpdate purchParmUpdate = PurchParmUpdate_ds.cursor();
        
        if (purchParmUpdate.CustomsImportOrderType_IN != CustomsImportOrderType_IN::ImportOrder)
        {
            specQty.delete("@GLS5652");
        }
        // Added  --> start
        select purchTable
            where purchTable.PurchId == purchParmTable.PurchId;
        if(purchTable.DocumentState == VersioningDocumentState::Confirmed && purchTable.PurchStatus == PurchStatus::Backorder)
        {
            PurchParmTable_TransDate.allowEdit(false);
            //PurchParmTable_TransDate.allowEdit(true);
        }
        // Added by J9074 on 22-03-2019 --> end
        //Added by Pavan 01-10-2020 for T17862 - GRN that if it is import order then only BOE option should be allowed to selected for Invoicing the PO
        if(PurchParmTable.purchTable().purchTable_W().CustomsImportOrder_IN == NoYes::Yes)// && documentStatus == DocumentStatus::PackingSlip)
        {
            if(PurchParmUpdate.SpecQty == PurchUpdate::BillOfEntryQuantity_IN)
            {
                PurchParmUpdate_ds.object(fieldNum(PurchParmUpdate, Specqty)).allowEdit(false);
            }
        }
        //end
        }
        
        //Added by Pavan 01-10-2020 for T17862 - GRN that if it is import order then only BOE option should be allowed to selected for Invoicing the PO
        if(PurchParmTable.purchTable().purchTable_W().CustomsImportOrder_IN == NoYes::Yes)// && documentStatus == DocumentStatus::PackingSlip)
        {
            if(PurchParmUpdate.SpecQty == PurchUpdate::BillOfEntryQuantity_IN)
            {
                PurchParmUpdate_ds.object(fieldNum(PurchParmUpdate, Specqty)).allowEdit(false);
            }
        }
    //end

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 545 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 408

#3
Adis Profile Picture

Adis 267 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans