Table level Event Handlers

 

ValidatedField Event Handler:

[DataEventHandler(tableStr(InventTable), DataEventType::ValidatedField)]

    public static void InventLocation_onValidatedField(Common sender, DataEventArgs e)

    {

        CST_ItemSubMaster cST_ItemSubMaster;

        InventTable inventTable = sender as InventTable;

        ValidateFieldEventArgs fieldArgs = e;

        boolean ret;

        switch(fieldArgs.parmFieldId())

        {

            case fieldNum(InventTable,CST_ParentItemId):


                select firstonly cST_ItemSubMaster where cST_ItemSubMaster.ChildItem == inventTable.CST_ParentItemId;


                if(cST_ItemSubMaster.ChildItem)

                {

                    ret =  checkFailed('@Costco:ParentChildItemError');

                    fieldArgs.parmValidateResult(ret);

                }

        }

    }

Comments

Popular posts from this blog

how to post trade agreement journals automatically using x++ code

How to Create a wizard in x++ d365

x++ code to submit and approve and reject the invent movement workflow in d365 F&O