27.10.2017, 10:11 | #1 |
Участник
|
dynamicsnavax: Chain of Command–next() gotcha
Источник: http://dynamicsnavax.blogspot.com/20...xt-gotcha.html
============== Be careful when using Chain of Command not to place the next() call in a condition. Here is an example. Create a class extension for a form. Call the method init() but place it in an “if” condition. Something like this. public void init() { if (this.args() && this.args().record()) { //do something before next init(); //this is inside the “if” condition //do something after } } The compiler will not error or give you a warning. However, at run time you will get a misleading error. In my case I got this. “Error executing code: Wrong argument type for function.” Having a look at Event viewer (Folder: AX-XppRuntime), it gave me a little more info. At least I know the class that was calling it. I searched for any customization. I found an extension class PurchReqCreate_Extension. I was able to eye ball and figure out the problem. Taking next() outside the “if” condition. Rewrote the same: public void init() { if (this.args() && this.args().record()) { //do something before } next init(); if (this.args() && this.args().record()) { //do something after }} Источник: http://dynamicsnavax.blogspot.com/20...xt-gotcha.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|