When user open journal lines from GL ---> General journal ---> Line
got below error
Solution:
1- Delete *.auc files from user Machine
2- release Usage data under Tools –> option –> Usage Data ---> reset button
Welcome to Axapta forum for learning, sharing and transferring dynamics AX knowledge and all related topics to Dynamics AX for example Business Intelligence (SSRS & SSAS), SQL, Workflow, SharePoint, ALL Dynamics AX Reporting tools, AX Integration ( AIF, Web Service, ...)
When user open journal lines from GL ---> General journal ---> Line
got below error
Solution:
1- Delete *.auc files from user Machine
2- release Usage data under Tools –> option –> Usage Data ---> reset button
All of us facing many issues while installing, deployment and customize AX 2012 reports. the Table below include most of troubleshooting of AX reports.
Source : https://technet.microsoft.com/en-us/library/gg731894.aspx
| Issue | Additional information for troubleshooting | ||
| The report is broken for any reason and the data source is a query. | Execute the query outside of the report. Confirm that the query returns expected results. Use a form, job, or Query Services to test the query. For more information, see Query Service. | ||
| The report is broken and the data source is a report data provider (RDP) class. | Debug the class. For more information, see How to: Configure the Debugger to Debug a Report Data Provider Class. | ||
| When you preview the report you receive the following error: No report data table with name <dataset table name> exists in report schema for data provider <RDP name>. | Verify that the report is bound to tables that exist and do not bind multiple datasets to a single report data provider class. Instead, define the report to have the multiple tables pointing to the same dataset. | ||
| No data was returned in the report. | Verify you have the right company, that there is data entered for that company, and that the user has access to the expected data. | ||
| The report has a rendering error. When you try to run the report, you receive an error like the following: An error has occurred during report processing. | The SSRS Execution Account password could be invalid.
| ||
| The report labels do not display, or the report shows label IDs, like Labels!@SYS24426 instead of the label values. | The SSRS Service Account password could be invalid.
| ||
| When running a report that uses an enumeration value as a multi-value parameter of a report, you get an error like the following: The ‘ParameterName’ parameter is missing a value. | Set the Data Type property of the enumeration parameter to Integer. This is because the label value of enumeration items are converted to name values in theSrsReportDataContractUIBuilder.getMultiSelectFromDialogField method. | ||
| When building a report project that uses a SQL report data source, you receive the following error: The report does not have the mandatory framework parameter AX_ReportContext. | Manually create the AX_ReportContext report parameter. For more information, see Walkthrough: Creating a Report with Parameters. | ||
| Time values in a report bound to an AOT query are displayed as h:mm:ss tt in Visual Studio preview and the Microsoft Dynamics AX client instead of the actual time. | Select the field in the report design and set the following properties:
| ||
| An AOS connection error message indicates you cannot establish a connection to the AOS. | To delete, rename, save, or restore a report model element, you must have a connection to the Application Object Server (AOS). If the AOS is disconnected or stops running after a reporting project is opened, an AOS connection error message will display. To continue, restart or restore the connection to the AOS, and then repeat the command that failed. | ||
| The Undo command is not functioning in the report model. | In Model Editor, only unsaved commands can be undone. Once a command is saved, it cannot be undone by using the Undo command. To revert a saved command, you must manually modify the report element. If you are using source code control, another option is to discard the file that is checked out if no other changes have been made. | ||
| The saved report model customization is not visible in Application Explorer. | Application Explorer does not automatically refresh as Model Editor saves changes to the model store database. To view changes in Application Explorer, right-click the model element, and then click Refresh. | ||
| The saved report model customization is not visible in the AOT. | The AOT does not automatically refresh as Model Editor saves changes in the model store database. To view changes in the AOT, in the Development Workspace Tools menu, click Development tools, Application objects, and then Refresh runtime model data. | ||
| When previewing a report in Visual Studio you receive the following error: The %0 parameter is missing a value %1 | Verify that you did not create a report with a Labels expression in the Values property of the report parameter. This is not supported because Reporting Services resolves parameter labels after the parameter evaluation and execution occur. --or-- Verify that you did not set the Allow Blank property to True to make the parameter optional. This is not supported for dataset bound parameters by the reporting framework. The following items identify the alternative approaches for OLTP and OLAP reports:
| ||
| The query for the report was changed but the report does not reflect the change. | After you run the report, the query and ranges are cached in the SRSReportQuery table. To refresh the cache, you must manually delete all records in the SRSReportQuery table for any reports or report parameters that use the query that was changed. | ||
| Locking or hiding a range for a report parameter is not working. At runtime, the parameter is enabled and the user is able to filter on the range. This occurs when a report is bound to a query that has a range value with a Status property value of Locked or Hidden. | SQL Server Reporting Services does not honor the query range Status property. | ||
| The Label reference does not display properly. The Value property is set to theParameters!MyParm.Value parameter. | The parameter must be explicitly bound to data using a dataset in the Visual Studio Tools for Microsoft Dynamics AX report model. | ||
| The parameter is explicitly bound to datasets with two columns, label and value. The value displays properly. The Label reference displays properly everywhere except in the client. | The report viewer control does not support the ability to specify report parameter labels, only values. | ||
| When you build a Visual Basic project for a report, the project does not build. -or- You receive the error “The business logic assembly ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null does not contain a class for report Report1.” | You must clear out the namespace setting of the Visual Basic project. In Solution Explorer, right-click the project, and then clickProperties. In the Application area, delete the text in the Root namespace field. | ||
| In Visual Studio, you build a project and receive the error, “System.InvalidOperationException: Object is currently in use elsewhere.” | This error indicates a synchronization issue. Close the solution and then rebuild the report. | ||
| When you debug a C# data method, the SQL Server Reporting Services server crashes. | This is a known issue if you are debugging a C# data method on a machine that is running a 64 bit operating system. To work around this issue, open Visual Studio 2008, load the C# file, set the break point, and then attach to the Reporting Services process. For more information, see Debugging Managed Code in Microsoft Dynamics AX. | ||
| Reports that run for more than ten minutes time out. For example:
Timeout error occured when calling AOS service. Use Dynamics AX Client Configuration Utility to change WCF configuration values. Exception details: The request channel timed out while waiting for a reply after 00:00:59.9449945. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. | See Tips to help prevent long-running reports from timing out. | ||
| Errors are generated when reports are saved to a file, printed to a printer, or emailed. | View the detailed error messages that are recorded for the Reporting module in the Exceptions form. Click System administration > Periodic > Services and Application Integration Framework > Exceptions. | ||
| The same report contains different information when saved to different file formats. For example, a sales invoice report that is saved to an .HTML file may contain header information, line items, and totals. When the same report is saved to an .XML file, it may contain only the line items and totals. | This is by design. For more information about how reports are rendered in the available file formats, see Exporting Reports (Report Builder 3.0 and SSRS) in the SQL Server documentation. | ||
| Users receive the following error when clicking on a drill-through link on a report in Enterprise Portal: [CompanyName] is not a valid company. Check the value and try again. | This situation may occur when Reporting Services 2008 or Reporting Services 2008 R2 is running in SharePoint integrated mode. To resolve this issue, install Reporting Services 2008 R2 with Service Pack 2.
| ||
| Tables are not aligned correctly when viewing reports in right-to-left (RTL) languages. | This is a known issue with the Reporting Services tablix control. For more information about the issue, see Known Issue: Dynamic Precision designs spacing issues in RTL languages in the Microsoft Dynamics AX Business Intelligence blog. | ||
| The Reporting Services extensions become unusable when additional Reporting Services instances are installed on the same computer. As a result:
| To resolve this issue, configure all the Reporting Services instances on the computer. For more information about how to install and configure multiple instances of Reporting Services on the same computer, see Install multiple instances of Reporting Services on the same computer (for use with Microsoft Dynamics AX). | ||
| When printing a report that has been saved as a PDF file, the printer page size does not correspond to the PDF page size. | To resolve this issue, select the Choose paper source by PDF page size check box in the Print window that is displayed when printing the report to the printer. | ||
| When using an environment that includes a hardware load balancer, such as F5, reports that run for more than five minutes time out. | To resolve this issue, adjust the timeout period specified in the hardware load balancer. For example, if you are using F5, set theIdle Timeout field to 7200 seconds or higher. For more information, see the F5 Knowledge Base. | ||
| You need to adjust the alignment of a report. | For tips on adjusting the alignment, see this blog post: SSRS report tips to adjust alignment for pre-formatted print stock (i.e. 1099-MISC form). |
To create a workflow, you must first select the type of workflow that you want to create. This topic lists the types of workflows that you can create in each module. The topic also describes what each type of workflow is used for, and whether the workflows of each type are associated with a specific company in the organization or with the whole organization.
After you install cumulative update 7 for Microsoft Dynamics AX 2012 R2, the Data Import/Export Framework appears to be installed, but you receive error messages when many forms are opened like the following:
You receive an “Assembly containing type Microsoft.Dynamics.AX.DMF.ServiceProxy.DmfEntityProxy is not referenced.” error
Reason: When you install cumulative update 7 for Microsoft Dynamics AX 2012 R2, the Data Import/Export Framework appears to be installed for members of the System Administrators role. However, the binary components of the framework are not present.
Solution:
Defragment indexes – You can defragment indexes from either SQL Server Management Studio or the Intelligent Data Management Framework (IDMF).
Update SQL Server statistics from SQL Server Management Studio – We recommend that you run both manual and automatic updates of statistics. Manual updates may become more important as the size of your database increases, because automatic updates are less likely to be completed on large data sets.
Reduce the size of the database – You can use IDMF to keep the size of the production database small. A small database makes database operations more efficient. For example, you can delete or archive data that is not required in your production system.
This post describes how to troubleshoot issues with a Data Import/Export Framework installation from InformationSource.
The Data Import/Export Framework does not compile
After you install the Data Import/Export Framework, if you cannot compile, validate that the Data Import/Export Framework was installed correctly.
Verify that the Microsoft Dynamics AX Data Import/Export Framework service is running.
Verify that the Data Import/Export Framework DLLs are present in C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin folder:
Microsoft.Dynamics.AX.DMF.Mapper.dll
Microsoft.Dynamics.AX.DMF.PreviewGrid.
Microsoft.Dynamics.AX.DMF.ServiceProxy.dll
DMFConfig.xml
Microsoft.Dynamics.AX.DMF.DriverHelper.dll
Resolution
Copy the DLLs from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Import Export Framework Client Component) to the C:\Program Files (x86)\Microsoft Dynamics AX\60\Client\Bin folder.
Exception message while you use Data Import/Export Framework
While you use the Data Import/Export Framework, you might receive the following error message:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException
Verify that the following files are present in the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance:
DMFConfig.xml
DMFClientConfig.xml
Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config
Resolution
Copy the .xml and the config files from the installation location (C:\Program Files\Microsoft Dynamics AX 2012 Data Import Export Framework Server Component) to the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance.
Changes to the location of the Data Import/Export Framework service
If you have to update the location where you run Integration Services and the Data Import/Export Framework service, you can update the endpoint address in the Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config file to use the new server name.
<endpoint address="http://<<NEW MACHINE NAME>>:7000/DMFService/DMFServiceHelper.svc"
Note
The Microsoft.Dynamics.AX.DMF.ServiceProxy.dll.config file is located in the C:\Program Files (x86)\Microsoft Dynamics AX\60\Server\Bin folder on the server that is running the AOS instance.
I developed custom class which extend RunBaseBatch system class to run in server, After created my class and run the class though batch job, there is an error is occurred and got the following error in log.
"Unable to construct an object from the class Sample Class in the batch framework. Make sure that the X++ code has been compiled to Microsoft .NET Framework CIL, and that the constructor does not require any parameters"
After search through internet I got solution by run “Generate incremental CIL” as displayed below
Hint: May it takes time depend on server configuration.
This post provides general recommendations for physical storage. Determine the applicability of these recommendations to your environment. Some storage area network (SAN) vendors may have alternative recommendations that take precedence. Recommendations are listed in order of priority.
Check existing disks on the server, and be aware of the differences in the analysis of basic partitions and dynamic volumes. Rebuild the partitions, if you can, and appropriate and create all new partitions based on guidance from the SAN vendor. If the vendor does not provide recommendations, follow the best practices for SQL Server. See Disk Partition Alignment Best Practices for SQL Server.
The partition offset value must be a multiple of the stripe size. In other words, the expression, partition offset / stripe size, must resolve to an integer value.
You might want to tune the database settings for Microsoft Dynamics AX to improve performance. Settings that you can tune include connections, query settings for the use of literals, string functions, or hints, concurrency mode used for database changes, and the table and index options, such as table and index data compression, and index fill factor and sort in tempdb settings.
Before changing settings, you should trace the usage of your Microsoft Dynamics AX database to ensure that you have clear understanding of performance under the current settings.
Test all tuning changes before implementing them in a production environment. In a test or development environment, make a single change and then test your system's performance before making another change.
Tune connections
The following table lists common connection issues, and also some adjustments to try in the Server Configuration Utility.
| Symptom | Adjustments to try |
| Queries that return a large number of rows execute slowly. | Increase the Maximum buffer size value in small increments. If this adjustment has worked, the number of round trips to the database, as measured in Performance Monitor by a decrease in the value of SQL Server statistics: batchrequestsPerSecond value. Stop increasing the value when the rate of improvement diminishes. You may also want to change the Maximum buffer size value if you receive an error similar to the following: The total, internal size of the records in your joined Select statement is 29374 bytes, but Microsoft Dynamics is by default performance-tuned not to exceed 27646 bytes. It is strongly recommended that you split your tables(s) into smaller units. Maximum buffer size refers to the size of buffer the kernel allocates for holding input/output data to and from SQL Server. The buffer can be used to hold more than one row of the entire result set for output binding, and it should be allocated large enough to hold at least one row. The buffer size needed for one row depends on the number of tables joined (exist join excluded) and the size of the aggregated table columns. When large numbers of joins are used, or wide tables, a customer may encounter the issue that the maximum buffer size is less than the space needed to hold one row of the result set. Due to the way the kernel handles data binding, the aggregated table column size is always the width of the entire table. Therefore, attempting to resolve the issue by limiting the field projection list does not help. You can fix the issue by rewriting the join, or by increasing the Maximum buffer size value. Because large joins and wide rows may lead to performance issues, we use this limit to catch performance issues and ask customers to rethink their joins. |
| Results for ad hoc queries are returned slowly | Verify that the appropriate indexes are in place. |
Tune queries
If queries in the system are running slowly, you may want to change settings for literals, string functions, or hints.
Adjust the use of hints
In Microsoft Dynamics AX, you can allow developers to override the index selected by the query optimizer. In most situations, allowing the query optimizer to select an index for a query results in improved performance.
Changes in the use of hints
The following changes to hints have been made:
· The OPTION (FIRSTFAST) hint is applied by default for form data sources. It can be suppressed, or set to a specific value. Use of this option appends an OPTION (FAST) to the SQL Server query.
· OPTION( FAST) is now set to what we expect the number of rows to be returned to the database in a single roundtrip. This is based on maximum buffer size.
· FASTFORWARD cursors are used for all user queries unless the query is a full text search.
Change table and index options
Table and index options that can be changed from within Microsoft Dynamics AX include table compression settings, and index compression, fill factor, and sort in tempdb settings.
Data compression options
If you have appropriate hardware, we recommend that you set all tables and indexes to use page-level compression. Compression saves disk space and memory consumption, but increases CPU consumption.
When page-level compression has been set, expect between 10-15 percent additional CPU consumption.
If you are concerned about CPU consumption, we recommend that you start by setting the ten largest tables in your system to use table compression.
Use the guidance in the following resources to help you determine how or whether to compress your tables and indexes:
· SQL Server Books online: Creating Compressed Tables and Indexes
· SQLCat article: Data Compression: Strategy, Capacity Planning and Best Practices
· Database Engine team blog post: Compression Strategies.
Fill factor options
We recommend that you not set the fill factor options (fill factor and pad index) for all indexes. Only set fill factor values on indexes that show rapid fragmentation, where fragmentation has a performance penalty. Adjusting fill factor can be important for tables that you want to retrieve sequential rows from, for example, sales line.
We recommend that you work with your database administrators to identify the tables to set this value for.
Sort in tempdb
We recommend that you not set the sort in tembdp options for all indexes. Only enable sort in tempdb for indexes that show rapid fragmentation, where fragmentation has a performance penalty.
We recommend that you work with your database administrators to identify the tables to set this value for.
To change table and index options
1. Click System administration > Periodic > Database > SQL administration. Select all tables, all indexes, or a specific table or index, and then click Table and index options.
2. Select the options to set, and then click Save.
The SQL statement that will be executed is displayed at the bottom of the form.
| The changes that you have made will not be applied unless you specify that they should be applied by using the SQL administration form. To turn off data compression, click Enable compression, click None for the type of compression, and then close the Select table and index options form, and then click Apply compression in the SQL administration form. |
3. To apply changes in the SQL administration form:
o For tables, click Table actions, and then click Apply compression.
o For indexes, click Index actions, and then click Reindex.
Change the concurrency mode
Concurrency mode settings enable you to reduce locking conflicts in your system. Set concurrency mode settings only at the table or statement level, not throughout your Microsoft Dynamics AX program.
Optimistic concurrency
An optimistic concurrency strategy does not lock data when the data is retrieved from the database for future modification. Therefore, no locks are held while filters and other business logic are being applied. Data is locked only when an update is performed. If any data has been changed by another transaction between the time of the retrieval and the time of the update, the change is detected and an Infolog exception is displayed.
Pessimistic concurrency
A pessimistic concurrency strategy uses an update lock to lock data when the data is retrieved from the database for future modification. Locks are held while filters and other business logic are being applied, in addition to being held during an update. Data cannot be changed by other transactions.
Acquiring an update lock for a large volume of rows increases the lock escalation from row level to table level in SQL Server. This can block other users and reduce transaction throughput.
Table-level concurrency settings
If the global concurrency mode is set to Optimistic concurrency mode enabled per table, table-level control of concurrency settings is available using the OccEnabled property.
Runtime update options
If you are encountering many update errors, you may want to use the runtime update options to help troubleshoot. These options are intended for temporary use only, as they might significantly slow performance.
Use Writes all UPDATE conflict exceptions to the log to write all update conflict exceptions to the log.
Use Update record version automatically to have Microsoft Dynamics AX search in memory for the recordID every time that that a record is updated, and then change the update values in all instances of the record.
If you have a table set to optimistic concurrency, and you are experiencing optimistic concurrency violations that affect the performance of the transactions that use the table, then first set the Writes all UPDATE conflict exceptions to the log option. If, from your analysis, it appears that the use of optimistic concurrency is causing a problem, then set the table to pessimistic concurrency.
To change concurrency settings
1. Click System administration > Setup > Database > Select concurrency mode.
2. Select the appropriate concurrency mode and runtime options for your environment.
3. Click Close.
Statement-level concurrency settings
You can use the optimisticlock or pessimisticlock keywords in a SELECT statement to override the global or table concurrency mode settings.
For more information, see the following topics:
· Best Practice Performance Optimizations: Database Design and Operations
Notifications may be sent to you when workflow-related events occur. For example, a notification may be sent to you when a document is assigned to you for approval or when the workflow process is completed for a document that you submitted. You can specify how you want to receive workflow notifications.
Click File > Tools > Options.
In the left pane of the Options form, click Notifications.
In the Receive notifications every (minutes) field, enter the number of minutes to specify how often you want to receive notifications.
In the Line-item notification type list, specify how you want to receive workflow notifications for line items from the following options:
Grouped – Notifications for line items are grouped into a single notification.
Individual – A notification is sent for each line item.
To receive notifications in the Microsoft Dynamics AX client, select the Show notifications in the Microsoft Dynamics AX client check box.
If you select the Show notifications in the Microsoft Dynamics AX client check box, you can also specify whether you want to receive notifications as pop-up messages. To receive pop-up messages, select the Show pop-ups for notifications check box.
To receive notifications as email, select the Send notifications in email check box.
In this walkthrough, you use a report data provider (RDP) class with business logic to process data and then display the outcome of the business logic on a report.
An RDP class is an X++ class that is used to access and process data for a Reporting Services report. The options for a data source type for a Microsoft Dynamics AX report are query, business logic, and RDP. An RDP class is an appropriate data source type when the following conditions are met.
The following illustration is a preview of the report that you create in this walkthrough.
| The data that displays in your report may vary depending upon the sample data that is available to you. |
The following elements are required to set RDP as your data source type.
This walkthrough illustrates the following tasks:
Creating a Temporary Table
Data for an RDP report is preprocessed and then stored in a temporary table. The temporary table is used by Reporting Services when the report is displayed. A table returned by a method can be a temporary table (InMemory or TempDB) or a regular table. When the data returned is used for reporting only, it is a best practice to use a temporary table.
In this section you will create a temporary table to store the data for the report.
To create a temporary table
Defining a Report Data Provider Class
The RDP class is a data provider that allows you to add business logic for the data that is displayed on a report. The business logic for this example prompts the end user for parameter values, processes business logic to generate data in a table, and then returns the table to render in the report. In this section, you define the RDP class by extending the SRSReportDataProviderBase class. Then add the TmpCustTableSample table as a global variable. The following list describes the attributes that are attached to the RDP class for this example:
For this example, set the attribute to the Cust query.
For this example, set the attribute to the SrsRDPContractSampledata contract.
To define a report data provider class
X++
[
SRSReportQueryAttribute (querystr(Cust)),
SRSReportParameterAttribute(classstr(SrsRDPContractSample))
]
public class SrsRdpSampleClass extends SRSReportDataProviderBase
{
TmpCustTableSample tmpCust;
}
Defining a Data Contract Class
An RDP class must have a data contract if the report has one or more report parameters. This example defines three report parameters for account number, account statement, and whether to include tax. When you print the report, you can specify which data to print based on the report parameters. For example, you can specify to only print transactions for account number 4000.
A data contract is an X++ class with getters, setters, and the DataMemberAttribute attribute. The data contract defines the parameters that the report uses.
To define a data contract class
X++
[DataContractAttribute]
public class SrsRDPContractSample
{
AccountNum accountNum;
CustAccountStatement accountStmt;
boolean inclTax;
}
A data contract class has methods with the DataMemberAttribute attribute. The name that follows this attribute is the parameter name that displays in Visual Studio when you bind a report data set to the RDP class. In this section, add a method for each of the report parameters and name them parmAccountNum, parmAccountStmt, and parmInclTax.
To define data contract methods
X++
[DataMemberAttribute("AccountNum")]
public AccountNum parmAccountNum(AccountNum _accountNum = accountNum)
{
accountNum = _accountNum;
return accountNum;
}
X++
[DataMemberAttribute("CustAccountStatement")]
public CustAccountStatement parmAccountStmt(CustAccountStatement _accountStmt = accountStmt)
{
accountStmt = _accountStmt;
return accountStmt;
}
X++
[DataMemberAttribute("InclTax")]
public boolean parmInclTax(boolean _inclTax = inclTax)
{
inclTax = _inclTax;
return inclTax;
}
Defining a Method to Return Data to Reporting Services
A method to return the processed data in the temporary table to Reporting Services is needed. In this section, add a method named getTmpCustTable and attach the SRSReportDataSetAttribute attribute to indicate the dataset for the report.
To define a method to return the data to Reporting Services
X++
[SRSReportDataSetAttribute("TmpCust")]
public TmpCustTableSample getTmpCustTable()
{
select * from tmpCust;
return tmpCust;
}
Adding Business Logic for the Report
The business logic for this example prompts the end user for parameter values, processes business logic to generate data in a table, and then returns the table to render in the report.
The report business logic is provided in the processReport method. This method is called by Reporting Services at runtime. The following example illustrates how the processReport method computes data and populates the data table that is returned to Reporting Services. In this section, override the processReport method to provide business logic for your report.
To add business logic for the report
X++
public void processReport()
{
AccountNum accountNumber;
CustAccountStatement custAcctStmt;
boolean boolInclTax;
Query query;
QueryRun queryRun;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
CustTable queryCustTable;
SrsRdpContractSample dataContract;
// Get the query from the runtime using a dynamic query.
// This base class method reads the query specified in the SRSReportQueryAttribute attribute.
query = this.parmQuery();
// Get the parameters passed from runtime.
// The base class methods read the SRSReportParameterAttribute attribute.
dataContract = this.parmDataContract();
accountNumber = dataContract.parmAccountNum();
custAcctStmt = dataContract.parmAccountStmt();
boolInclTax = dataContract.parmInclTax();
// Add parameters to the query.
queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
if(accountNumber)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
}
// If an account number has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(accountNumber);
}
if(custAcctStmt)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountStatement));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountStatement));
}
// If an account statement has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(int2str(custAcctStmt));
}
if(boolInclTax)
{
queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, InclTax));
if (!queryBuildRange)
{
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, InclTax));
}
// If flag to include tax has not been set, then use the parameter value to set it.
if(!queryBuildRange.value())
queryBuildRange.value(int2str(boolInclTax));
}
// Run the query with modified ranges.
queryRun = new QueryRun(query);
ttsbegin;
while(queryRun.next())
{
tmpCust.clear();
queryCustTable = queryRun.get(tablenum(CustTable));
tmpCust.AccountNum = queryCustTable.AccountNum;
tmpCust.CustName = queryCustTable.name();
tmpCust.LogisticsAddressing = queryCustTable.address();
tmpCust.CustGroupId = queryCustTable.CustGroup;
tmpCust.Phone = queryCustTable.phone();
tmpCust.CustInvoiceAccount = queryCustTable.InvoiceAccount;
tmpCust.CustAccountStatement = queryCustTable.AccountStatement;
tmpCust.InclTax = queryCustTable.InclTax;
tmpCust.insert();
}
ttscommit;
}
Creating a Reporting Project
Next, create a reporting project in Microsoft Visual Studio. When you create a reporting project, you use the Report Model to create a Reporting Services report.
To create a reporting project
A reporting project contains a report model where you can add a report to the model.
Binding a Report to a Report Data Provider Class
Now that you have created a reporting project, you are ready to define an auto design report that displays data from the Cust query. The following procedure explains how to create an auto design report that uses the RDP class as the data source.
To create an auto design report
| Property | Value | ||
| Data Source | Dynamics AX | ||
| Data Source Type | Report Data Provider | ||
| Default Layout | Table | ||
| Dynamic Filters | True
| ||
| Name | Customer | ||
| Query | Click the ellipsis button (…). A dialog box displays where you can select an RDP class that is defined in the AOT and identify the fields that you want to use. Select the SrsRDPSampleClass class and click Next. In the Select Fields dialog box, keep all the checkboxes selected, and click OK.
|
| If you expand the Parameters node you see the parameters that you defined in the data contract class. When you define nested data contract parameters, they are listed under the Parameters node also. Select the SrsRDPSampleClass_DynamicParameter parameter. In the Properties window, the AOT Query property is set to the query specified in the parmQuery method in the RDP class. |
| You can use * to display all of the account numbers on the report. Account statement is an enumeration and there is no wild card value for enumerations. Check your sample data to determine a valid enumeration value for Account statement. The Select button displays because you set the Dynamic Filters property to True on the dataset. You have the option to click the Select button to specify a range to filter the report and limit the data that displays on the report. |
The next steps are to add layout and style templates, deploy, and add the report to a menu item so you can see it in Microsoft Dynamics AX.
A Microsoft Dynamics AX workflow task is a single unit of work that must be performed. A workflow may contain one or more tasks.
The following procedure describes how to create a new workflow task in the AOT.
To create a workflow task
| Value | Description |
| Name | The name that will be used for the workflow task. |
| Workflow document | The class that defines the workflow document for which you are creating a task. This setting must match the Document property setting used in the workflow type for the task. |
| Document preview field group | The initial set of fields displayed in the unified work list. Select a field group from the root table specified in the Workflow document that you selected. The Workflow document value must be set before you can select a field group. |
| Document menu item | Choose the menu item that points to the main form that displays the document for which you are creating a workflow task. |
| Document web menu item | Choose the web menu item that points to the Enterprise Portal page that displays the document for which you are creating a workflow task. |
Click Add.
| Note Each task must have one outcome of type Complete. |
After a workflow task is created, you can add the workflow task to the Supported Elements node of a workflow type.
Microsoft Dynamics AX table fields are defined in a query to create workflow conditions. A limitation of a Microsoft Dynamics AX query is that you cannot define calculated fields in the query itself. It is a common scenario to use calculated fields to determine the behavior of a workflow. For example, a dynamic sales total of all records in a table can be used as a workflow condition to determine whether the step should be used. To overcome this query limitation, you must use a workflow document class.
The workflow document class that you create defines table fields for conditions in two ways: the Application Object Tree (AOT) query and parameter methods. The getQueryName method of the WorkflowDocument Class must be overridden to return the name of the query. You can optionally add calculated fields by adding parameter methods with a specific signature on the class.
Before you begin these procedures, you must create a query that specifies the data that will be accessed.
The following procedures show how to create a workflow document class including a parameter method for a calculated field.
Note
If you used the Workflow Wizard to create the workflow type, the workflow document class will have already been created by the wizard.
In the AOT, expand the Classes node.
Right-click the Classes node, and then select New Class. A class group displays under the Classes node.
Right-click the new class, click Rename, and then enter a name for the workflow document class.
Expand the new class, select classDeclaration, right-click the class declaration, and then click Edit.
Enter the following code in the class declaration.
class <MyWorkflowDocumentClassName> extends WorkflowDocument
{
}
Close the Editor window and click Yes to save changes.
Right-click the new class, point to Override Method, and then click getQueryName. A method node named getQueryName displays under the workflow document class node and the Editor window opens.
Note
Be sure to select getQueryName as the method to override. The WorkflowDocument.getQuery Method is used only internally to retrieve the actual query based on the string returned by theWorkflowDocument.getQueryName Method.
In the Editor window, enter the following code for the query method.
QueryName getQueryName()
{
return querystr(<MyWorkflowDocumentQueryName>);
}
After you create the workflow document class, you can bind it to the workflow type. For more information, see How to: Associate a Workflow Document Class with a Workflow Type.
To add a calculated field to the workflow document class, it must:
Be named parm <name>.
Define the parameters CompanyId, TableId, and RecId.
Return an extended data type that will be included in the list of fields for defining conditions or notification messages. The label for the EDT must uniquely identify the value.
In the workflow document class that you want to add a calculated field to, right-click the class, and then click New Method. A new method node displays under the Classes node.
Right-click the new method node, and then click Edit. Enter code that uses the format shown in the following code example.
The following code example shows how to add a calculated field to determine the total credit amount for a journal.
public TotalJournalCreditAmount parmTotalJournalCreditAmount(CompanyId _companyId, TableId _tableId, RecId _recId)
{
// The calculateAmounts method contains business and validation logic
this.calculateAmounts(_companyId, _tableId, _recId);
return totalJournalCreditAmount;
}
When you create a workflow type in Microsoft Dynamics AX, it must be assigned to a workflow category. The workflow category determines whether a workflow type is available in a specific module. If an appropriate workflow category does not already exist, you must create one.
For example, a workflow type for a customer invoice should not be available in the Master planning module. To make the workflow type available only in the Customer module, create a workflow category with the Customer module selected.
The following procedure describes how to create a new workflow category.
To create a workflow category
| Property | Value |
| Name | The name that is used to reference the workflow category. |
| Label | The label used for the workflow category in the user interface. |
| Help Text | The description of the workflow category displayed in the configuration user interface. |
| Module | The module that the workflow will be available in. The default is Ledger. |
After a workflow category is created, you can bind the workflow type to the new category. Typically, this is performed by the Workflow Wizard. The following procedure describes how to manually bind a workflow type to a workflow category.
To bind a workflow type to a workflow category
In Microsoft Dynamics AX, modules are enabled for workflow. However, in some cases, you will need to create a new module that contains workflow. In each module that contains workflow, a Workflows list menu item must be added to the Setup pane. The following procedures are described in this topic:
To Add a Module to the ModuleAxapta Base Enum
To Create a Display Menu Item for the Workflows List
| Property | Value |
| Name | Set to WorkflowConfigurations<xxx> where <xxx> is replaced by a reference to the name of the new module. For example, you could set this value to WorkflowConfigurationsRecruit for a new module named Recruiting. |
| Label | Set text or a label that represents the text for the workflows list in the client. |
| ObjectType | Set to Form. |
| Object | Set to WorkflowTableListPage. |
| EnumTypeParameter | Set to ModuleAxapta. |
| EnumParameter | Set to the enum created in the preceding procedure. |
After the new module enum and display menu item are created, you can add them to the Menus node.
To Create a Menu for a New Module
| Property | Value |
| Name | Set to a label or name of the new module. |
| Label | Set to a label that represents the text to display for the new menu in the client. |
| Property | Value |
| Name | Set to Setup or another label that represents the text for the Setup pane in the client. |
| Label | Set to Setup or another label that represents the text for the Setup pane in the client. |
| NormalImage | Set to 3478. This will display a gears icon for the setup pane. |
| ImageLocation | Set to EmbeddedResource. |
After the menu for the new module is created, you must add a reference to the menu in the MainMenu node to display the menu in the client.
To Add a Menu to the Client
Workflow documents in a Microsoft Dynamics AX workflow must implement a state model to represent the state of a workflow, approval, or task for a workflow document in the application. For example, a workflow document in the NotSubmitted state can be changed to the Submitted state when a user clicks the Submit button. This section describes how to enable the state model for a workflow document by using a class or by creating a method on a table.
The following table contains recommended states. However, the needs of your application will determine what states are needed, validation type for state transitions, and how many states are needed. For more information, see Workflow Approval State Transitions post.
| For the state of the | Use |
| Workflow document |
|
Typically, the workflow state should be persisted in the root table of your workflow document data source. To add workflow state to a table, create an enum in the BaseEnums node of the Application Object Tree (AOT) that contains the workflow states shown in the previous table. The first enum defined should be the NotSubmitted enum, and this will also be the default setting in the table. After the enum is defined, drag the enum to the Fields node of the workflow document data source table. For more information, see Enums.
After a state model is defined, you can enable forms and lists to work with workflow. For more information, see How to: Enable a Form or List for Workflow post.
Note : Workflow state can be implemented in many ways. The following procedure shows one way of performing this task.
In the AOT, expand the Classes node.
Right-click the Classes node, and then select New Class. A class group displays under the Classes node.
Right-click the new class, click Rename, and then enter a name for the class.
Right-click the new class and then click New Method. A method node named method1 displays under the Classes node.
Right-click method1 and then click Edit. Enter the following code for the started event method.
public static void started(RecID _recID)
{
<insert method here>
}
Repeat steps 4 and 5 for the remaining states.
The following code is part of the setWorkflowState on the PurchReqTable Table. This method sets the workflow state field in the table and updates the user interface with a user friendly status, and then updates the state in the database.
static void setWorkflowState(RecId _purchReqRecId, PurchReqWorkflowState _purchReqWorkflowState)
{
// Declare variables.
PurchReqTable purchReqTable;
ttsbegin;
// Selects the record to be updated based on the recId and then
// sets the workflow state.
purchReqTable = PurchReqTable::findRecId(_purchReqRecId, true);
purchReqTable.State = _purchReqWorkflowState;
// Based on the workflow state, the status in the user interface
// is updated with a user friendly status.
switch (_purchReqWorkflowState)
{
case PurchReqWorkflowState::Submitted:
purchReqTable.Status = PurchReqStatus::Submitted;
break;
case PurchReqWorkflowState::NotSubmitted:
purchReqTable.Status = PurchReqStatus::Draft;
break;
case PurchReqWorkflowState::Completed:
purchReqTable.Status = PurchReqStatus::Completed;
break;
case PurchReqWorkflowState::Returned:
purchReqTable.Status = PurchReqStatus::Rejected;
break;
case PurchReqWorkflowState::ChangeRequest:
purchReqTable.Status = PurchReqStatus::ChangeRequested;
break;
}
// Commits the state to the database.
purchReqTable.update();
ttscommit;
}
Microsoft Dynamics AX workflow documents that are enabled for workflow approvals typically support at least five workflow states. The current workflow state of a workflow can be maintained in a table field associated with the workflow document. As the state of the document is changed, the state field in the table should be updated. This topic describes workflow approval states.
Workflow State
Workflow state determines what you can do with the workflow document as soon as it is available in the system. Workflow states are defined by developers and must be supported in queries and business logic for operations that are controlled by workflow. Workflow approvals typically use the following workflow states.
| Workflow state | Use |
|---|---|
| NotSubmitted | The state of the document before it is submitted to workflow or if the workflow is canceled. This is the state of all documents before a workflow instance is instantiated for the document. |
| Submitted | The state of the document as soon as the workflow is activated and the document is submitted to workflow. This is a temporary state when the user activates a workflow, but the system has not yet processed the workflow for activation. |
| PendingApproval | The state of the document as soon as the approval starts and remains in this state until the approval is completed, returned for a change, or rejected. |
| ChangeRequested | The state of the document if a change is requested or the document is returned. |
| Approved | The state of the document when the approval is completed. |
The following diagram illustrates a typical approval state transition model.
Here are some general guidelines for workflow state:
Avoid creating your own workflow states unless you have a business justification for doing this.
Consider refactoring existing approval states so that you can take advantage of the states listed here.
To enable a Microsoft Dynamics AX workflow for a new or existing application module, you must complete a series of required steps and then, depending on application requirements, complete additional steps. This topic describes the required steps to add workflow to your application.
Required Steps
The following steps are necessary for every workflow:
Create a state model. For more information about a recommended state model, see Workflow Approval State Transitions and How to: Enable a State Model for a Workflow Document.
Add a workflow display menu item. The workflow display menu item is used to access the workflow types for each module. For more information, see How to: Create a New Module with Workflow.
Create a workflow category. A workflow category filters workflow types to a single module. If adding a new module, extend the ModuleAxapta Base Enums type. For more information, see How to: Create a Workflow Category.
Create a workflow document class to define the workflow document for the workflow. You will create a query, and if needed, add calculated fields to identify the derived fields available for conditions displayed in the workflow configuration tool. For more information, see How to: Create a Workflow Document Class.
Enable a form or list for workflow. You must set properties on a form or list to display the workflow button and controls. For more information, see How to: Enable a Form or List for Workflow.
Enable documents to be submitted to the workflow. For more information, see How to: Enable Workflow Submission.
Create a workflow type. A workflow type defines information about which workflow document to use, tasks, automated tasks, approvals, line item workflows, workflow category, menu items, and event handlers. For more information, see Creating a Workflow Type.
Activate the workflow. There are several ways to activate the workflow. For more information, see Activating a Workflow.
Define and implement event handlers for the workflow, approvals, tasks, and automated tasks. For more information, see Handling Workflow Events.
Implement workflow providers for due date, participant, hierarchy, and queue assignment. For more information, see Workflow Providers.
Define and implement approvals, tasks, and automated tasks. For more information, see Creating Workflow Tasks, Automated Tasks, and Approvals.
Optional Steps
Create custom workflow providers. For more information, see How to: Create a Custom Workflow Provider.
Create event handlers for tasks. For more information, see How to: Create a Workflow Event Handler.
Hint : You can find and follow All mentioned topics related to this post at my blog.
Workflow is defined as the movement of documents or tasks through a work process. In Microsoft Dynamics AX, the focus of workflow is on approval and task-oriented workflows. The developer role in Microsoft Dynamics AX is primarily to add workflow to existing business documents or create new documents that support workflow. This topic describes what the workflow life cycle is and the developer role for a workflow in Microsoft Dynamics AX.
Workflow can be described as structured or unstructured. In Microsoft Dynamics AX, workflow is structured and based on user interaction and system automation of business data. For example, when a purchase requisition (business data) is created it, workflow can be used to verify and approve the data.
Workflow Lifecycle
All workflows follow a basic life cycle as shown in the following illustration.
You design the workflow based on customer requirements. The company administrator configures the workflow, and users run the workflow. This section describes the some of the main development concepts used in the design section of the workflow life cycle in Microsoft Dynamics AX.
Workflow types
The workflow type is a building block that can be used to create customized workflows that enforce business policies. The workflow type is defined in the Application Object Tree (AOT) at design time. The metadata from the workflow type is used by the customer to create a workflow configuration.
Workflow configurations
Workflow configurations are created by application administrators that use the Microsoft Dynamics AX workflow editor. The administrator configures the workflow, workflow elements, and approval steps that control the flow of the business document though the workflow process.
Workflow instances
A workflow instance is created by the workflow runtime when a workflow is activated.
Workflow elements
The elements of a workflow are created by you in the AOT and configured by application administrators. The workflow structure consists of sequences of workflow elements. An element can be a task, automated task, approval, or a sub-workflow.
Approvals are specialized workflow elements that allow for sequencing of multiple steps, which use a fixed set of outcomes. Tasks are generic workflow elements that represent a single unit of work which use custom outcomes defined by the developer. Automated tasks are workflow elements used to invoke X++ code within the application without requiring human intervention.
Work items
Work items are the units of work created by the workflow at runtime. They are the main interface between the end user who participates in a workflow and the workflow runtime. All work items for users who are logged on are surfaced in the Unified Work List and are used to inform a user about work assignments.
Developer Role
You must create the workflow artifacts, dependent workflow artifacts, and business logic to support the workflow. The following sections describe most of the developer artifacts used in a Microsoft Dynamics AX workflow.
Workflow Artifacts
Workflow type
Define the workflow document.
Define event handlers for workflow Started, Completed, ConfigDataChanged, and Canceled.
Define menu items used for the workflow type like Submit.
Define the workflow category.
Define required approvals, tasks, and automated tasks.
Enable and disable activation conditions.
Workflow category
Define the module that the workflow type is enabled in.
Approval
Define the approval workflow document.
Define approval event handlers for Started and Canceled.
Define approval menu items such as Document, Resubmit, and Delegate.
Enable or disable fixed approval outcomes.
Define approval outcome menu items for Action and ActionWeb.
Define approval outcome event handler.
Define the DocumentPreviewFieldGroup.
Task
Define the task workflow document.
Define task event handlers for Started and Canceled.
Define task menu items for Document, DocumentWeb, Resubmit, ResubmitWeb, Delegate, and DelegateWeb.
Enable or disable task outcomes.
Define task outcome menu items for Action and ActionWeb.
Define task outcome event handler.
Define the DocumentPreviewFieldGroup.
Automated Task
Define the automated task workflow document.
Define automated task event handlers for Execution and Canceled.
Dependent Workflow Artifacts
The following workflow artifacts are dependent upon the type of workflow defined in the AOT.
Workflow Document class - identifies the document query and any calculated fields.
Document query - defined in the AOT to expose data that is used for conditions in the configuration user interface.
SubmitToWorkflow class - displays the Submit to Workflow dialog box in the user interface, receives user comments, activates the workflow, and can update workflow state.
State model - tracks the state of the document in the workflow process, for example, Submitted, ChangeRequested, or Approved.
Event handlers for the workflow itself on the workflow type, approval, approval outcomes, automated task, task, and task outcomes.
Action and display menu items as well as classes which determine the action taken when a menu item is selected in the user interface.
Custom workflow providers.
canSubmitToWorkflow method - required on each table enabled for workflow.
In Microsoft Dynamics AX, each form or list that is to be used by workflow must be enabled for workflow. This topic describes the steps to enable a form for workflow. It also describes the steps to enable a list for workflow.
When a form is enabled for workflow, the workflow menu bar is automatically inserted at the top of the form, below the form title bar or action pane. The workflow menu bar provides everything that you must have to interact with a workflow. The menu bar contains workflow action buttons, such as Submit and Complete, and data fields that contain workflow instructions, configuration name, and information icons.
To display the Submit button, the form must have a canSubmitToWorkflow method.
Note: The form data source, or table, must contain a field for the workflow state of the document. For example, a field that contains the workflow state NotSubmitted should be updated to Submitted when the user clicks the Submit button on the form.
In the Application Object Tree (AOT), expand the Forms node.
Expand the form that you want to enable for workflow, and then expand the Designs node.
In the Designs node, right-click the Design child node, and then click Properties.
In the Properties sheet, set the following properties.
| Property | Value |
| WorkflowEnabled | Set to Yes to enable the workflow menu bar on the form. The default setting is No. |
| WorkflowDataSource | Set to the same root data source specified in the query used for the Document property on the workflow type. |
| WorkflowType | Set to the workflow type that you want to use for the list. |
In the AOT, right-click the form, and then click Save.
In the Application Object Tree (AOT), expand the Forms node.
Expand the form for the list that you want to enable for workflow, and then expand the Designs node.
In the Designs node, right-click the Design child node, and then click Properties.
| Property | Value |
| WorkflowEnabled | Set to Yes to enable the workflow menu bar on the list. The default setting is No. |
| WorkflowDataSource | Set to the same root data source specified in the query used for the Document property on the workflow type. |
| WorkflowType | Set to the workflow type that you want to use for the list. |
5. In the AOT, right-click the List, and then click Save.