AX – D365FO – How to intercept the onclick event of a Form system buttons (New, Delete)

How to intercept the onclick event of New (SystemDefinedNewButton) or Delete (SystemDefinedDeleteButton) system buttons of a Form?

in your Form you have to use task method

   public int task(int _taskId)
    {
        #Task

        int ret;

        switch (_taskId)
        {
            case #taskNew:
                //insert your Insert method here 
                break;
            case #taskDeleteRecord:
                //insert your Delete method here
                break;
            default:
                ret = super(_taskId);
        }

        return ret;
    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s