Skip to main content

Notifications

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,084

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

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Data Migration Making COC of a method of dynamics ax 2012

    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

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Data Migration Making COC of a method of dynamics ax 2012

    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,996 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,853 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans