AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 27.10.2017, 10:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
stoneridgesoftware: Using the new Chain of Command feature in X++ Blog bot DAX Blogs 0 29.09.2017 07:11
dynamicsnavax: Hybrid connection - Web Api App for AX 2012 to Azure-part 4 Blog bot DAX Blogs 0 14.09.2017 13:11
axmfg: Supply chain excellence in manufacturing Blog bot DAX Blogs 0 01.11.2013 01:11
Dynamics AX: Managing Your Supply Chain Using Microsoft Dynamics AX 2009 - Book Review Blog bot DAX Blogs 0 31.03.2009 23:06
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 17:44.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.