Hola.
Cuando por alguna situación requerimos escribir código para el evento "onLookup" de un control en un formulario de Dynamics 365 FO, nos encontramos que al ejecutarlo se muestra el mensaje "More Than One Form Was Opened at Once for the Lookup Control"
Captura de ejemplo:
Para solucionarlo, sigue los siguientes pasos:
1. Declara una nueva variable del tipo "FormControlCancelableSuperEventArgs"
2. Inicializa la variable con el valor FormControlEventArgs del parámetro "e"
3. Usa la variable para llamar al método CancelSuperCall()
Ejemplo:
Enjoy daXing
D365 F&O
D365 Development
Thursday, February 21, 2019
Wednesday, December 19, 2018
Extension de una Tabla en Dynamics 365 Finance and Operations
Una de las novedades que más impacto puede traer a la hora de querer agregar funcionalidad a objetos nativos de Ax es que se recomienda NO tocar los Originales (Overlaying) y en vez de esto, crear un extensión del mismo y ahí hacer las modificaciones pertinentes.
Esto tiene una ventaja enorme, significa mantener los objetos intactos y cuando Microsoft haga alguna actualización pues no tocará nada de lo que hayamos desarrollado afectando únicamente al estándar de Ax.
Vamos a la práctica.
Supongamos que tenemos una tabla con cierto número de campos y queremos agregar algún otro campo que haga falta sin afectar a la tabla original.
Vamos a crear una nueva Tabla (en la vida real, esta sería una tabla nativa de Ax)
Le agregamos los campos base:
Ahora vamos a crear una extensión de la tabla (Buscamos nuestra tabla desde el AOT, si no se encuentra, debemos sincronizar primero el proyecto con la base de datos)
Esto agrega un nuevo objeto a nuestro proyecto con el Nombre del objeto original y agregando .Extensión
Lo abrimos y le agregamos un nuevo campo:
Sincronizamos nuevamente y ahora vamos a escribir algo de código. La idea es instanciar un objeto de la tabla original (MyTable) que a su vez, al tener una extensión, debería mostrarnos tres campos (dos originales y uno de la extensión)
El job, agrega un nuevo registro. Para comprobar la funcionalidad, visualizamos la tabla en el explorador:
Como podemos ver, la tabla tiene tres campos, y no dos como originalmente estaba diseñada.
Espero haberles ayudado.
Saludos!
Esto tiene una ventaja enorme, significa mantener los objetos intactos y cuando Microsoft haga alguna actualización pues no tocará nada de lo que hayamos desarrollado afectando únicamente al estándar de Ax.
Vamos a la práctica.
Supongamos que tenemos una tabla con cierto número de campos y queremos agregar algún otro campo que haga falta sin afectar a la tabla original.
Vamos a crear una nueva Tabla (en la vida real, esta sería una tabla nativa de Ax)
| Clic derecho sobre el proyecto, Add y finalmente New ítem.. |
| En la sección Data Model, tenemos la opción Table. Le damos un nombre y agregamos |
Le agregamos los campos base:
| Los campos se agregan de manera tradicional; click derecho, New, tipo de dato deseado... |
Ahora vamos a crear una extensión de la tabla (Buscamos nuestra tabla desde el AOT, si no se encuentra, debemos sincronizar primero el proyecto con la base de datos)
| Sobre el AOT, se puede hacer una búsqueda para encontrar nuestro objeto al cual le crearemos un "Extensión" |
| Extensión del Objeto |
Lo abrimos y le agregamos un nuevo campo:
| Abrir el objeto Extension |
| Se agrega el nuevo campo |
| La instancia del Objeto MyTable muestra el campo creado en la Extension |
El job, agrega un nuevo registro. Para comprobar la funcionalidad, visualizamos la tabla en el explorador:
| Para visualizar los datos de la tabla en un Web Browser |
| Vista previa de la tabla con los tres campos y sus datos respectivamente. |
Como podemos ver, la tabla tiene tres campos, y no dos como originalmente estaba diseñada.
Espero haberles ayudado.
Saludos!
Tuesday, December 18, 2018
Ejecutando un JOB en Dynamics 365 Finance and Operations
En Dynamics 365 todo es diferente.
Veamos como ejecutar un Job con un poco de código sencillo
Primero creamos el Proyecto:
Configuramos el Model y la opción para que se sincronice automáticamente al hacer "Build"
Agregamos una "Runnable class"
Agregamos algo de código
Establecemos la clase como objeto de inicio (Set as StartUp Object)
Y ahí tenemos el resultado!
:)
Saludos
Veamos como ejecutar un Job con un poco de código sencillo
Primero creamos el Proyecto:
Agregamos algo de código
Establecemos la clase como objeto de inicio (Set as StartUp Object)
Finalmente ejecutamos el proyecto (F5)
Y ahí tenemos el resultado!
:)
Saludos
Wednesday, November 29, 2017
Max number of sessions in WHS Dynamcs Ax 2012 R3
When we implemented a WHS module in Dynamics Ax 2012 R3, we experimented
some issues but the most stressfull issue was the WHS web service crashed with five
or six concurrent users.
I tought it was a configuration parameter about limit of
conecctions, but i didnt know wich parameter, maybe an IIS parameter or AIF
parámeter, was the second.
First of all, we have to select the follow menú: System
Administration/ Setup / Services and Application Integration Framework/ EndPoints
In the endpoints form we are going to filter the whs* as the
follow image show

We are going to desactivate the endpoint and then we clic
the setup button and then, if we don’t have the right software tool to edit the
file, the notepad Will open the file.
The netTCPBinding node has a maxConnections parameter but it was
useless in this scenario.
But ServiceThrotting parameter had the solution, we had 200
in values of maxCurrentCalls, maxCurrentInstances, maxCurrentSessions

So, each users made several petitions to the service, even a
user who refreshed the webpage repeatly
Just we increased the value of each parameter and we notice
the website was supported more users tan before.
It really works for us!
See you!
Labels:
200,
AIF,
AX,
Dynamics Ax 2012 R3,
netTCPBinding,
ServiceThrotting,
Web Service,
WHS,
WMS,
X++
Tuesday, November 28, 2017
Saving a Dynamics Ax Report to PDF
Hi guys!
I am gonna show you how to save a Dynamics Ax Report to PDF file.
We are going to use de getTempPath() method from WinApi class for getting the tmp directory.
static void saveProdId()
{
ReportRun report;
Args args;
ProdBOM prodBOM;
FilePath path;
ProdId prodId;
;
path = WinAPI::getTempPath();
prodId= 'ProdIdNumber';
select prodBOM where prodBOM.ProdId == prodId
&& prodBOM.ProdLineType == BomType::Vendor;
args = new Args();
args.name(reportStr(SomeReport));
args.record(prodBOM);
report = ClassFactory.reportRunClass(args);
report.printJobSettings().setTarget(PrintMedium::File);
report.printJobSettings().preferredTarget(PrintMedium::File);
report.printJobSettings().format(PrintFormat::PDF);
report.printJobSettings().fileName(path + prodId + '.pdf');
report.query().interactive(false);
report.run();
}
See you!
I am gonna show you how to save a Dynamics Ax Report to PDF file.
We are going to use de getTempPath() method from WinApi class for getting the tmp directory.
static void saveProdId()
{
ReportRun report;
Args args;
ProdBOM prodBOM;
FilePath path;
ProdId prodId;
;
path = WinAPI::getTempPath();
prodId= 'ProdIdNumber';
select prodBOM where prodBOM.ProdId == prodId
&& prodBOM.ProdLineType == BomType::Vendor;
args = new Args();
args.name(reportStr(SomeReport));
args.record(prodBOM);
report = ClassFactory.reportRunClass(args);
report.printJobSettings().setTarget(PrintMedium::File);
report.printJobSettings().preferredTarget(PrintMedium::File);
report.printJobSettings().format(PrintFormat::PDF);
report.printJobSettings().fileName(path + prodId + '.pdf');
report.query().interactive(false);
report.run();
}
See you!
Labels:
Dynamics Ax 2012 R3,
getTempPath,
getTempPath(),
PDF,
printJobSettings,
Report,
WinApi,
X++
Monday, November 13, 2017
Using Infolog Ax 2012 R3
In this post you can learn how to use InfoLog class for sending a beautiful and professional messages in Dynamics Ax, however final user could not notice your effort.
static void testJCAinfo(Args _args)
{
SetPrefix("Grandpa");
SetPrefix("Dad");
SetPrefix("Me");
Infolog.add(Exception::Warning,"Puppy");
}
And the result is:
static void testJCAinfo(Args _args)
{
SetPrefix("Grandpa");
SetPrefix("Dad");
SetPrefix("Me");
Infolog.add(Exception::Warning,"Puppy");
}
And the result is:
Now you have the power to agroup the info messages in Ax, but you can give more functionally if you want. check the code below
static void Test(Args _args)
{
SysInfoAction_FormRun infoAction = SysInfoAction_FormRun::newFormName(formStr(EcoResProductDetailsExtended)); //Which form?
infoAction.parmCallerBuffer(InventTable::find('TEST5')); // which record??
Infolog.add(Exception::Warning,"El artículo no está propiamente configurado",'',infoAction);
}
First, we got the itemid with errors (TEST5)
In the message infolog we select the message
Notice a new button is appear automatically, and if you click on it, Ax shows you the EcoResProductDetailsExtended with the TEST5 Item.
Wednesday, November 1, 2017
Using RoundUp and RoundDown
Sometimes we would need to round a number, in this case you can use global method roundUp or rounDown.
static void roundExample()
{
info(num2expstr(roundUp(6.5 ,1)));
}
The result is 7,
This morning I was in trouble using this function... the result was 6 instead 7 such as if I would using roundDown, some minutes later I notice I was tryng rounding a negative number LOL.
Subscribe to:
Comments (Atom)





