26 July 2012

AX 2012 view and edit mode

To find out if an AX 2012 form is in view or edit mode just call:

element.inViewMode();

To catch the event of changing the mode you have to override the task() method of the form and check the value of the _taskId.

public int task(int _taskId) 

    #task 
    int ret;

    ret = super(_taskId); 

    if (_taskId == #taskEditRecord) 
    { 
        info("edit or view mode?"); 
    } 

    return ret; 
}

No comments: