Quantcast
Channel: Martin Dráb's Activities
Viewing all 17532 articles
Browse latest View live

StringEdit control in form..

$
0
0

Hi,

I have created a stringedit field in the grid which is not bound to any datasource table,Whenever i enter the data in that field and close that form and reopen it the values is not appearing again.

Can you please tell how to store the value in that  grid even after closing the form.

Please advise.

Regards,

AXTechie2120


Several modules in one package

$
0
0

Hello,

Can someone provide me a practical example of when having more than 1 module in a package is a good thing?

I see that almost all standard packages have only one module inside.

So, does 1:1 module-package relationship considered as a good practice? 

End of support, Dynamics AX 2012

$
0
0

Hello everyone,
what is the end of support DYNAMICS AX 2012 ?

Please to provide me the information source.

Display method calculation for Forms

$
0
0

Hi ,

I have created three new fields in formPSAcontractlineitem

Fields1  (input)

Fields2 (computation ,based on field1 input)

Fields3

i want to compute the the values based on existing values

like Fields2 = oldvalue - field1

fields3 = existingfield *Field2/100

i have created following display method on form datasource :

but now displaying correct information and errors

"public display Amount lookupPSAContractLineItems()


{   

PSAContractLineItems psaContractLineItems2 ;
    real total;
    //total= 0;
    
   // DirPartyName dirpartyname ;
    
     
    select SL_EngineeringEstimates from psaContractLineItems2
    
     where psaContractLineItems2.recid==5637146078 ;
       
    
    total = total + (psaContractLineItems.SL_EngineeringEstimates /psaContractLineItems.EA_OtherExpense) ;
    
    return total ;
    

}"

thanks

Printing reports from code in D365FO

$
0
0

A comment below my blog post Printing reports from code in AX2012 asked me to provide an example for D365FO. Here is it.

The code is virtually identical. Only writing a file to a shared folder doesn’t make a good sense in cloud, therefore I changed the code to return the file to user for download.

SrsReportRunController          controller =new SrsReportRunController();
SysUserLicenseCountRDPContract  rdpContract =new SysUserLicenseCountRDPContract();
SRSPrintDestinationSettings     settings;
 
// Define report and report design to use
controller.parmReportName(ssrsReportStr(SysUserLicenseCountReport, Report));
// Use execution mode appropriate to your situation
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
// Suppress report dialog
controller.parmShowDialog(false);
 
// Explicitly provide all required parameters
rdpContract.parmReportStateDate(systemDateGet());
controller.parmReportContract().parmRdpContract(rdpContract);
 
// Change print settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.fileName('UserLicenseCount.xlsx');
 
// Execute the report
controller.startOperation();

Object could not be created because abstract method classname.XXX() has not been implemented.

$
0
0

I am getting this weird error in a class. 

I have class A and 2 extended classes B and C. I have created an abstract method in class A and used them in B and C. It was working fine. But all of a sudden I get this error during compilation. Do you have any idea why this error pops up and what could be the possible solution?

Thanks

Report printed to e-mail

$
0
0

You can easily send a D365FO report in email just by configuring print destination to Email and setting a few properties.

You can do the same from code, where you can also set the body. You must create an instance of SrsReportEMailDataContract class, fill it values and pass it to SRSPrintDestinationSettings.parmEMailContract(). Here is an example:

SrsReportRunController controller =new SrsReportRunController();
 
controller.parmReportName(ssrsReportStr(SysUserRoleInfo, Report));
controller.parmShowDialog(false);
 
SRSPrintDestinationSettings settings = controller.parmReportContract().parmPrintSettings();
 
settings.printMediumType(SRSPrintMediumType::Email);
settings.fileFormat(SRSReportFileFormat::PDF);
settings.fileName('SysUserRoleInfo.xlsx');
 
// Here we configure the email
SrsReportEMailDataContract emailContract =new SrsReportEMailDataContract();
 
emailContract.parmTo("user@example.com");
emailContract.parmSubject("Security report");
emailContract.parmBody("Hi there! Here is your report.");
 
settings.parmEMailContract(emailContract);
 
controller.startOperation();

Computed Column Dates

$
0
0
Hi all
Running AX 2012 R3 CU9.

Having a bit of a problem with a computed column in a view. I'm trying to limit the data to purely data after X days ago (in this case 90 days). The obvious way I thought to do it, it doesn't seem to filter anything at all:
return strFmt("SELECT COUNT(%1) FROM %2 WHERE %3 = %4 AND %5 > %6 AND DATAAREAID = 'ABC'",
        fieldStr(ABC_Usage_RawData, Qty),
        tableStr(ABC_Usage_RawData),
        fieldStr(ABC_Usage_RawData, ItemId),
        SysComputedColumn::returnField(tableStr(ABC_Usage_FinalFigures), tableStr(InventTable), fieldStr(InventTable, ItemId)),
        fieldStr(ABC_Usage_RawData, DatePhysical),
        systemDateGet()-365
        );
In this example, Usage_FinalFigures is my view, and Usage_RawData is a view which has all the transactions I need. But it won't filter by date at all, it just gives the same answer regardless.
Am I doing something wrong?
Thanks very much in advance for your help
Cheers
Luke

Custom export to MS Word

$
0
0

In model XYZ, there exists tables and a form in which the user can build a contract with clauses, headers, references and everything that could possibly exist in a contract. It also includes font and paragraph parameters (like alignment, borders, colors, etc).

Long ago one of my colleagues wrote implementation in AX2012 to export this data into the appropriate (user specified) format in MS Word, using COM (which I understand is deprecated).

I need to implement the same type of thing in D365.

Where should I start? What can I read? Any comments? Is this once again something that should be done with Data Entities?

I don't think the source code is sensitive. If you are interested, I'll post screenshots - it's not too extensive.

Thanks for reading

Word document from code

$
0
0

Sometimes you may want to generate a Word document from code in D365FO, which gives you much more control over the result than if you simply printed a report to Word.

Here is a very brief example of how you can do it.

Start with creating an X++ project. Then add a C# class library to the same project. Right-click the C# project, use Manage NuGet Packages… and install DocumentFormat.OpenXml package.

Then add the following class:

usingSystem.IO;usingDocumentFormat.OpenXml;usingDocumentFormat.OpenXml.Packaging;usingDocumentFormat.OpenXml.Wordprocessing; 
namespace WordLib
{publicclass WordDoc
    {public Stream Create(){
            MemoryStream ms =new MemoryStream(); 
            using(WordprocessingDocument wordDocument =
                WordprocessingDocument.Create(ms, WordprocessingDocumentType.Document, true)){
                MainDocumentPart mainPart = wordDocument.AddMainDocumentPart(); 
                string text ="Do androids dream of electric sheep?";
                Body body =new Body(new Paragraph(new Run(new Text(text)))); 
                mainPart.Document=new Document(body);} 
            return ms;}}}

This code will create a very simple Word document, containing only a single line of text, and returns it as a memory stream. You would likely need something more complicated, but that’s out of scope of this blog post. You can get more information from Open XML SDK documentation.

Build the C# class library and we’re done with it; now we need to call it from X++.

Go to the X++ project, right-click References, chose Add Reference… and add a project reference to the C# library.

Then add a runnable class with the following code, which merely calls the library and returns the stream as a file to user:

class WordDocGeneratorSample
{publicstaticvoid main(Args _args){     
        using (System.IO.Stream wordStream =new WordLib.WordDoc().Create()){
            File::SendFileToUser(wordStream,'file.docx');
        }}}

Set the class as the startup object, run the project and your browser should offer you the Word document for download.

Dynamics365 Development Training for Beginners

$
0
0

HI All,

I am new to Dynamics 365. Infact I have never worked on Dynamics product line. I am c# developer for web api development and desktop applications ranging from winforms to WPF.

I now feel to learn dynamics 365 as desktop applications doesn't seems to have much future. 

I already created on account and started navigation and basics of 365. 

Can anyone suggest me where  i can find the  hands on labs or development tutorials?

What other technologies do I need to learn apart from C Sharp?

Printing reports from code in D365FO

$
0
0

A comment below my blog post Printing reports from code in AX2012 asked me to provide an example for D365FO. Here is it.

The code is virtually identical. Only writing a file to a shared folder doesn’t make a good sense in cloud, therefore I changed the code to return the file to user for download.

SrsReportRunController          controller =new SrsReportRunController();
SysUserLicenseCountRDPContract  rdpContract =new SysUserLicenseCountRDPContract();
SRSPrintDestinationSettings     settings;
 
// Define report and report design to use
controller.parmReportName(ssrsReportStr(SysUserLicenseCountReport, Report));
// Use execution mode appropriate to your situation
controller.parmExecutionMode(SysOperationExecutionMode::Synchronous);
// Suppress report dialog
controller.parmShowDialog(false);
 
// Explicitly provide all required parameters
rdpContract.parmReportStateDate(systemDateGet());
controller.parmReportContract().parmRdpContract(rdpContract);
 
// Change print settings as needed
settings = controller.parmReportContract().parmPrintSettings();
settings.printMediumType(SRSPrintMediumType::File);
settings.fileFormat(SRSReportFileFormat::Excel);
settings.fileName('UserLicenseCount.xlsx');
 
// Execute the report
controller.startOperation();

I try to send an XML, but it shows the following error, how can I identify it?

$
0
0

How i can identify the next error:

Failed to validate the identity restriction 'tempuri.org/DSCargaRemisionProv.xsd:DSCargaRemisionProvKey3'. A key is missing or the existing key has an empty node.

The XSD is:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="DSCargaRemisionProv" targetNamespace="tempuri.org/DSCargaRemisionProv.xsd"
	elementFormDefault="qualified" attributeFormDefault="qualified" xmlns="tempuri.org/DSCargaRemisionProv.xsd"
	xmlns:mstns="tempuri.org/DSCargaRemisionProv.xsd" xmlns:xs="www.w3.org/.../XMLSchema"
	xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
	<xs:element name="DSCargaRemisionProv" msdata:IsDataSet="true">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element name="Remision">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Proveedor" type="xs:int" />
							<xs:element name="Remision" type="xs:string" />
							<xs:element name="Consecutivo" type="xs:short" />
							<xs:element name="FechaRemision" type="xs:dateTime" />
							<xs:element name="Tienda" type="xs:short" />
							<xs:element name="TipoMoneda" type="xs:short" />
							<xs:element name="TipoBulto" type="xs:short" />
							<xs:element name="EntregaMercancia" type="xs:short" />
							<xs:element name="CumpleReqFiscales" type="xs:boolean" />
							<xs:element name="CantidadBultos" type="xs:decimal" />
							<xs:element name="Subtotal" type="xs:decimal" />
							<xs:element name="IEPS" type="xs:decimal" />
							<xs:element name="IVA" type="xs:decimal" />
							<xs:element name="OtrosImpuestos" type="xs:decimal" />
							<xs:element name="Total" type="xs:decimal" />
							<xs:element name="CantidadPedidos" type="xs:int" />
							<xs:element name="FechaEntregaMercancia" type="xs:dateTime" />
							<xs:element name="Cita" type="xs:int" minOccurs="0" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Pedimento">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Proveedor" type="xs:int" />
							<xs:element name="Remision" type="xs:string" />
							<xs:element name="Pedimento" type="xs:int" />
							<xs:element name="Aduana" type="xs:short" />
							<xs:element name="AgenteAduanal" type="xs:short" />
							<xs:element name="TipoPedimento" type="xs:string" />
							<xs:element name="FechaPedimento" type="xs:dateTime" />
							<xs:element name="FechaReciboLaredo" type="xs:dateTime" />
							<xs:element name="FechaBillOfLading" type="xs:dateTime" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Pedidos">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Proveedor" type="xs:int" />
							<xs:element name="Remision" type="xs:string" />
							<xs:element name="FolioPedido" type="xs:int" />
							<xs:element name="Tienda" type="xs:short" />
							<xs:element name="CantidadArticulos" type="xs:int" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Articulos">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="Proveedor" type="xs:int" />
							<xs:element name="Remision" type="xs:string" />
							<xs:element name="FolioPedido" type="xs:int" />
							<xs:element name="Tienda" type="xs:short" />
							<xs:element name="Codigo" type="xs:decimal" />
							<xs:element name="CantidadUnidadCompra" type="xs:decimal" />
							<xs:element name="CostoNetoUnidadCompra" type="xs:decimal" />
							<xs:element name="PorcentajeIEPS" type="xs:decimal" />
							<xs:element name="PorcentajeIVA" type="xs:decimal" />
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:choice>
		</xs:complexType>
		<xs:key name="DSCargaRemisionProvKey1" msdata:PrimaryKey="true">
			<xs:selector xpath=".//Remision" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
		</xs:key>
		<xs:key name="DSCargaRemisionProvKey3" msdata:PrimaryKey="true">
			<xs:selector xpath=".//mstns:Pedimento" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
		</xs:key>
		<xs:key name="DSCargaRemisionProvKey4" msdata:PrimaryKey="true">
			<xs:selector xpath=".//mstns:Pedidos" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
			<xs:field xpath="mstns:FolioPedido" />
		</xs:key>
		<xs:key name="DSCargaRemisionProvKey5" msdata:PrimaryKey="true">
			<xs:selector xpath=".//Articulos" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="mstns:Remision" />
			<xs:field xpath="mstns:FolioPedido" />
			<xs:field xpath="mstns:Tienda" />
			<xs:field xpath="mstns:Codigo" />
		</xs:key>
		<xs:keyref name="RemisionPedimento" refer="DSCargaRemisionProvKey1">
			<xs:selector xpath=".//mstns:Pedimento" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
		</xs:keyref>
		<xs:keyref name="RemisionPedidos" refer="DSCargaRemisionProvKey1">
			<xs:selector xpath=".//mstns:Pedidos" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
		</xs:keyref>
		<xs:keyref name="PedidosArticulos" refer="DSCargaRemisionProvKey4">
			<xs:selector xpath=".//mstns:Articulos" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
			<xs:field xpath="mstns:FolioPedido" />
		</xs:keyref>
		<xs:key name="DSCargaRemisionProvKey6" msdata:PrimaryKey="true">
			<xs:selector xpath=".//mstns:Articulos" />
			<xs:field xpath="mstns:Proveedor" />
			<xs:field xpath="Remision" />
			<xs:field xpath="mstns:FolioPedido" />
			<xs:field xpath="mstns:Tienda" />
			<xs:field xpath="mstns:Codigo" />
		</xs:key>
	</xs:element>
</xs:schema>


Thanks in advance!!

Generating XML document from AX 2012 and sending through SFTP

$
0
0

Hi

Can someone suggest me the better way to approach for below requirement?

We need to send vendor payments/other data to 3rd party application using SFTP channel. Third party application will accept XML formats and below are the versions.

  1. XML V2
  2. XML V3

Generating XML by using XmlDocument classes or generating XML data file using AIF.(I think we need transformation to get right XML file).

Or any other way to generate XML document.

Thanks in advance for your time and help on the same.

Regards,

KVNKK

Number sequence without using class

$
0
0

Hi,

Please suggest on how to create a number sequence without using any class in ax 2012 r3.

Please advice.

Regards,

AXTechie 2120


Several modules in one package

$
0
0

Hello,

Can someone provide me a practical example of when having more than 1 module in a package is a good thing?

I see that almost all standard packages have only one module inside.

So, does 1:1 module-package relationship considered as a good practice? 

Difference between Model store deployment and XPO deployment

$
0
0

Hi All,

Please explain the difference between Model store deployment and XPO deployment technically,

Regards,

Akbar

Call API in and out in Dynamics 365

$
0
0

Dear Friends,
I have a case:
1/ The ABC have a legacy Retail application (on-premise).
2/ The CEO want to purchase Dynamics 365 and integrate with Retail application
Question:
1/ I want to write the code from Dynamics 365 call API of Retail application. Could you share the code?.
2/ I want to write the code from Retail application call API of Dynamics 365. Could you share the code?.
Thank you.

AX 2012 R3 - Compile warnings

$
0
0
I am struggling with installing a fresh AX 2012 R3 where I get warnings when compiling the application and compiling into CIL. I have installed the Database, AOS and Client on one server for demo purpose. The server is a Windows Server 2012 Standard edition, the database engine is SQL Server 2012. After installing the three components, I ran the initial checklist with a full application compile and thereafter CIL compile. After running the full application compilation I got the warning: Could not load file or assembly 'Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. Previously I have had an AX 2012 R2 with EP installed, but I have uninstalled that including SharePoint Foundation 2010. I figure that this warning is raised because I missed deleting a regKey? When compiling into CIL I get the following two warnings: Finished pass 1 at 10-07-2014 11:16:57 Finished pass 2 at 10-07-2014 11:20:50 Exception was thrown because the .NET instance method Microsoft.Dynamics.Framework.Portal.Deployment.EPWebModule.DeployWebModuleFromAOT was not found during CIL generation in class sysEPWebPageDefinition.deployModuleOnServer. Generating the code to make a reflection call during run time. Information: Either the .NET instance method Microsoft.Dynamics.Framework.Portal.Deployment.EPWebModule.DeployWebModuleFromAOT or its parameters could not be resolved during CIL generation, in class sysEPWebPageDefinition.deployModuleOnServer. Generating the code to make a reflection call during run time. Exception was thrown because the .NET instance method Microsoft.Dynamics.Framework.Portal.Deployment.EPWebPartPage.ImportWebPartPageFromAOT was not found during CIL generation in class sysEPWebPageDefinition.deployPageOnServer. Generating the code to make a reflection call during run time. Information: Either the .NET instance method Microsoft.Dynamics.Framework.Portal.Deployment.EPWebPartPage.ImportWebPartPageFromAOT or its parameters could not be resolved during CIL generation, in class sysEPWebPageDefinition.deployPageOnServer. Generating the code to make a reflection call during run time. Finished pass 3 at 10-07-2014 11:33:28 Finished creating types at 10-07-2014 11:34:11 Errors: 0 Warnings: 2 I really like to have a clean compilelog and I have tried recompile several times with the same result. Please advice.

Delete orphan sales order in x++

$
0
0

Hi everyone,

I have deleted a sale order by x++ job.but the inventory impact is not updating on 'on hand' form.i mean if i the item quantity was 3 at sale order line.

then after deleting sale order.the quantity is still coming on 'On Hand'form with on order 3.someone please guide me.

my query was that

Static void DelsO(Args args)

{
SalesTable saleTable;
SalesLine salesLine;

salesIdBase salesidbase;

select saleTable where
salestable.saleid == 'so-98989'
&& salestable.salesStatus == salesstatus::backorder
&& salestable.Documentsatsu == documenrtstatus::None
if(salestable)
{

salesidbase = salestable.salesid;

delete_from salestable

where salestable.salesid == salesidbase ;

}

}

Viewing all 17532 articles
Browse latest View live