tag:blogger.com,1999:blog-33929778426076943262024-03-19T01:55:14.232-07:00Trix2axThis is a blog about Microsoft Dynamics AX.My intention to write this blog is to help the new programmers in AX.Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-3392977842607694326.post-23869416927004895122017-01-15T08:21:00.000-08:002017-01-15T08:21:42.220-08:00Initialization checklist stuck on DB sync.<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: red;">Issue:</span></b><br />
<br />
Initialization checklist is stuck on Synchronize Database (Required). It is not checked even after synchronizing.<br />
<br />
<br />
<b><span style="color: lime;">Solution:</span></b><br />
<br />
Open a new development workspace> AOT> Jobs > create new<br />
<pre class="prettyprint linenums" style="background: rgb(238, 238, 238) !important; border: none !important; box-sizing: border-box; color: #303131; font-family: monospace, serif; font-size: 12px; padding: 10px !important; white-space: pre-wrap;">static void SyncByPass(Args _args)
{
SysCheckList::finished(classnum(SysCheckListItem_Synchronize));
}</pre>
Save and Run this job. It will by pass the synchronize database step.<br />
<br />
Note: Make sure that you do the DB sync atleast once else it will throw SQL errors when you try to upload the demo data.</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-74497422583211946082014-08-24T06:48:00.000-07:002014-08-24T06:48:06.264-07:00The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError)<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;"><b>Complete Error:</b></span><br />
<span style="color: red;"><b><br /></b></span>
The report server has encountered a configuration error. Logon failed for the unattended execution account. (rsServerConfigurationError)<br />
Log on failed. Ensure the user name and password are correct. (rsLogonFailed)<br />
<br />
Logon failure: the specified account password has expired.<br />
<br />
<span style="color: lime;"><b>Solution:</b></span><br />
<span style="color: lime;"><b><br /></b></span>
Go to <b>Start </b>> <b>Reporting Service Configuration Manager > </b>open tab <b>Execution Account</b><br />
<b><br /></b>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwA_8YTutKWBeOyOdXoJP7n5rybUJhmnuWP4XruNC8hX7H013ENAwxPVcZKb8yKKU_27eAcNvTGYfHG2DojHh9sG2BxXKa9Ou-7Uq0fgZ8mweWyXlHPieCmpPiOuHlT4HfRP_XKVdfmOmR/s1600/config+manager.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwA_8YTutKWBeOyOdXoJP7n5rybUJhmnuWP4XruNC8hX7H013ENAwxPVcZKb8yKKU_27eAcNvTGYfHG2DojHh9sG2BxXKa9Ou-7Uq0fgZ8mweWyXlHPieCmpPiOuHlT4HfRP_XKVdfmOmR/s1600/config+manager.png" height="261" width="400" /></a></div>
<b><br /></b>
Now enter the correct credentials.<br />
<br />
Then try running the report again.The error must be gone.</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com3tag:blogger.com,1999:blog-3392977842607694326.post-84507530479372386872014-08-24T05:04:00.000-07:002014-08-24T05:04:04.615-07:00Deploying SSRS Reports using PowerShell in AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<b>This is to describe more in detail about <span style="color: red;">Deploying SSRS Reports from Microsoft PowerShell:</span></b><br />
<b><span style="color: red;"><br /></span></b>
<b><span style="color: red;"><br /></span></b>
To open Microsoft PowerShell:<br />
<br />
Go to <b>Administrative tools </b>> M<b>icrosoft Dynamics AX 2012 management shell</b>(run as administrator to avoid any unexpected errors)<br />
<br />
The Microsoft PowerShell window opens up:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf5ewsUExM9unzqP_vSjQWANqZA8Pe4XeBRYFYXeZ_OJdm1QWUSFBGw5jP_YW7XwcKtPNNHndnf0Jig2pi4hnQtxH2A5XWNDCqRW4L3rrGrrssTj5WNhoI5pB47c-0nHUxi4XzmW2rzsib/s1600/AX+2012+PowerShell.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhf5ewsUExM9unzqP_vSjQWANqZA8Pe4XeBRYFYXeZ_OJdm1QWUSFBGw5jP_YW7XwcKtPNNHndnf0Jig2pi4hnQtxH2A5XWNDCqRW4L3rrGrrssTj5WNhoI5pB47c-0nHUxi4XzmW2rzsib/s1600/AX+2012+PowerShell.png" height="197" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
As you can see this is not the basic Windows Powershell.This will import four different modules on its own.<br />
"C:Windows\system32> Get-Command" will get you all the commands available.<br />
<br />
<br />
<br />
<ul style="text-align: left;">
<li>To Deploy your report type the command:</li>
</ul>
<br />
<span style="color: lime;">C:Windows\system32> Publish-AXReport -ReportName DemoReport1</span><br />
<br />
This will deploy single report named "DemoReport1".<br />
<br />
<br />
<ul style="text-align: left;">
<li>To Deploy all the SSRS reports type in the command:</li>
</ul>
<br />
<span style="color: lime;">C:Windows\system32> Publish-AXReport -ReportName *</span><br />
<br />
This will deploy all the SSRS Reports to the Reporting Server.<br />
<br />
<br />
<ul style="text-align: left;">
<li>Here is a little trick to deploy specific reports:</li>
</ul>
<br />
<span style="color: lime;">C:Windows\system32> Publish-AXReport -ReportName XYZ_*</span><br />
<br />
This will deploy all the reports starting with the name "XYZ_" .So we can use our project naming prefix here to deploy all the reports made for a particular functionality as wildcard is supported here.<br />
<br />
<br />
<ul style="text-align: left;">
<li>Another note to check the server configuration is:</li>
</ul>
<br />
<span style="color: lime;">C:Windows\system32> Test-AXReportServerConfiguration</span><br />
<br />
Try running this before you start.If everything is set to true here we are good to go.<br />
<br />
<br />
<span style="color: red; font-weight: bold;">Note:</span><span style="font-weight: bold;"> </span><i>The Microsoft Dynamics AX 2012 Management Shell is very powerful and fast.To deploy 1000 reports it would take only about 10mins which would have taken approx 45mins for 200 reports in AX 2009 SSRS.</i><br />
<i><br /></i>
Thanks,<br />
<br /></div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-46093724111991424322014-08-20T08:35:00.000-07:002014-08-20T08:35:35.936-07:00Calling SSRS Report from X++ code.<div dir="ltr" style="text-align: left;" trbidi="on">
<b><span style="color: red;">Run SSRS Report without a modified contract using X++ code</span></b><br />
<b><span style="color: red;"><br /></span></b>
static void Job_RunSSRSReport(Args _args)<br />
{<br />
<br />
///srsreportruninterface class provides a set of APIs to run report programmatically.<br />
SrsReportRunInterface reportRun;<br />
<br />
//Create an instance of the report<br />
//Pass in the report that you want to run by using the syntax<br />
// '<ReportName>.<DesignName>'<br />
reportRun = new SrsReportRunImpl('SampleReport.Design');<br />
<br />
// Run the report that is passed.<br />
<br />
reportRun.runReport();<br />
<br />
}</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-70589488588607172282014-08-19T09:03:00.001-07:002014-08-19T09:32:00.781-07:00Global Address Book Transition from AX 4.0 to AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;"><b>Address transition from AX 4.0 to AX 2012</b></span><br />
<span style="color: red;"><b><br /></b></span>
<b><u>In Microsoft Dynamics AX 4.0:</u></b><br />
<b><u><br /></u></b>
Entity's data was stored in the entity table itself.<br />
e.g: CustTable holds consumer name,contact information and address.<br />
<br />
<br />
<b><u>In Microsoft Dynamics AX 2009:</u></b><br />
<b><u><br /></u></b>
Although Global Address Book was introduced it was not fully functional.The entity tables still holds the entity data but the data is synchronized to global address book tables.<br />
<br />
<br />
<b><u>In Microsoft Dynamics AX 2012:</u></b><br />
<b><u><br /></u></b>
Now data is just stored in the global address book tables.The transition is complete and now there is no need of synchronization.<br />
Also it is global data i.e one record per entity for one system.Unlike previous versions where it was stored one record per entity for every company.<br />
So address data duplication has reduced to a large extent.<br />
<br />
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-88778028402300698812014-08-16T10:54:00.000-07:002014-08-16T10:55:21.354-07:00Ways to open AOT in AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Ways to open AOT/Developer workspace in AX 2012:</b><br />
<br />
<ol style="text-align: left;">
<li>Press Ctrl-Shift-W.</li>
<li>Navigate to Windows > New Development Workspace.</li>
<li>Press CTRL + D.</li>
<li>Add the -development switch to the ax32.exe command when starting Microsoft Dynamics AX.</li>
</ol>
<br />
<br />
<div>
<span style="color: red;"><b>Note:</b></span></div>
<div>
Once the development workspace is open we can add multiple AOT's by pressing CTRL+D.This is helpful in using the drag n drop functionality. </div>
<div>
<br /></div>
<div>
<br /></div>
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-45616179883047394222014-08-16T06:57:00.000-07:002014-08-16T06:59:32.023-07:00 The port 'TestServiceGroup' could not be deployed.\nError: The port 'TestServiceGroup' has no service operations.<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Solution:</b><br />
<b><br /></b>
This error comes up when we are trying to deploy a service group and create a inbound port.<br />
And the service that is added to the service group has no operations added to it.<br />
<br />
<br />
<ul style="text-align: left;">
<li>Go back to <b>AOT </b>> <b>Service </b>>'Service with error' ><b>Operations </b>> right-click and click <b>Add Operation</b>.</li>
<li>A new '<b>Add Service Operations</b>' form is opened up.</li>
<li>Select the Operations to be added by marking the checkbox ><b>Add</b>.</li>
<li>This will add the operations to the service and the service group will now deploy without any errors.</li>
</ul>
<br />
<br />
<b><span style="color: red;">Note: </span></b><br />
<br />
<ul style="text-align: left;">
<li>Operations once added will not be visible in the form.</li>
<li>The operation is a method of the service contract class and applies the [SysEntryPointAttribute] to it.</li>
</ul>
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-61955727227871286172014-08-12T21:49:00.001-07:002014-08-12T21:49:32.143-07:00Export to excel in AX using X++<div dir="ltr" style="text-align: left;" trbidi="on">
Export AX data to excel file using X++ code and with a directory select option.<br />
<span style="color: red;">Use the following code:</span><br />
<br />
static void Export_to_excel(Args _args)<br />
{<br />
//Excel classes<br />
SysExcelApplication xlsApplication;<br />
SysExcelWorkBooks xlsWorkBookCollection;<br />
SysExcelWorkBook xlsWorkBook;<br />
SysExcelWorkSheets xlsWorkSheetCollection;<br />
SysExcelWorkSheet xlsWorkSheet;<br />
SysExcelRange xlsRange;<br />
//tables used<br />
CustTable custTable;<br />
BILLDetailsTable billdetailstable;<br />
CustTransHistoryTable custtranshisttable;<br />
CustTransHistoryLines custtranshistlines;<br />
//variables<br />
int row = 1;<br />
str fileName;<br />
transdate frmdate,todate;<br />
Area area;<br />
//Dialog instances<br />
Dialog dlg;<br />
DialogGroup dlgGroup;<br />
DialogField digfield,digfield1,digfield2;<br />
DialogField dialogFilename;<br />
;<br />
<br />
dlg = new Dialog("AX Export");<br />
dlgGroup = dlg.addGroup("Enter details");<br />
digfield = dlg.addField(TypeID(transdate),"From Date");<br />
digfield1 = dlg.addField(TypeID(transdate),"To Date");<br />
digfield2 = dlg.addField(TypeID(MIDCarea),"Area");<br />
//this will provide directory window where you can save the file.Don't forget to write a filename at the end of the path.<br />
//e.g C:\newexcel.xls<br />
dialogFilename = dlg.addFieldValue(typeid(Filepath),filename);<br />
<br />
dlg.run();<br />
frmdate =digfield.value();<br />
todate =digfield1.value();<br />
area =digfield2.value();<br />
<br />
if(!frmdate||!todate||!area)//validating dialog values<br />
{<br />
throw error("Enter complete data");<br />
}<br />
<br />
//Filename<br />
fileName = dialogFilename.value();<br />
//Initialize Excel instance<br />
xlsApplication = SysExcelApplication::construct();<br />
//Open Excel document<br />
//xlsApplication.visible(true);<br />
//Create Excel WorkBook and WorkSheet<br />
xlsWorkBookCollection = xlsApplication.workbooks();<br />
xlsWorkBook = xlsWorkBookCollection.add();<br />
xlsWorkSheetCollection = xlsWorkBook.worksheets();<br />
xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);<br />
//Excel columns captions<br />
xlsWorkSheet.cells().item(row,1).value("CustAccount");<br />
xlsWorkSheet.cells().item(row,2).value("PaymentVoucher");<br />
xlsWorkSheet.cells().item(row,3).value("ReceiptDate");<br />
row++;<br />
//newcode<br />
<br />
<br />
while select custtranshisttable<br />
order by custtranshisttable.CustAccount<br />
where custtranshisttable.Area == area<br />
&& custtranshisttable.ReceiptDate >= frmdate<br />
&& custtranshisttable.ReceiptDate <= todate<br />
{<br />
while select sum(amountsettled),ItemId,InvoiceId from custtranshistlines<br />
group by custtranshistlines.ItemId<br />
where custtranshistlines.PaymentReceiptID == custtranshisttable.PaymentReceiptID<br />
&& custtranshistlines.InvoiceId == custtranshisttable.InvoiceNo//current<br />
{<br />
xlsWorkSheet.cells().item(row,1).value(custtranshisttable.CustAccount);<br />
xlsWorkSheet.cells().item(row,2).value(custtranshisttable.PaymentVoucher);<br />
xlsWorkSheet.cells().item(row,3).value(custtranshisttable.ReceiptDate);<br />
row++;//current row is complete now incrementing to new row.<br />
}<br />
}<br />
//Check for duplicate files<br />
if(WinApi::fileExists(fileName))<br />
WinApi::deleteFile(fileName);//if found delete it<br />
//Save Excel document<br />
xlsWorkbook.saveAs(fileName);<br />
//Open Excel document<br />
xlsApplication.visible(true);<br />
//Close Excel<br />
xlsApplication.quit();<br />
xlsApplication.finalize();<br />
}<br />
<br />
Sorry for bad editting :P<br />
<br />
Thanks</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-89309832720216483792014-08-12T08:33:00.001-07:002014-08-12T08:33:37.691-07:00Calling number sequence from X++code in AX<div dir="ltr" style="text-align: left;" trbidi="on">
At times we need to call the next number from a particular<b> number sequence using X++ code.</b><br />
Following is the code to do so:<br />
<br />
static void numberSeq_Demo(Args _args)<br />
{<br />
NumberSeq numberSeq;<br />
int nextNo;<br />
;<br />
ttsbegin;<br />
<br />
numberSeq = numberSeq::newGetNum<br />
(NumberSeqReference::findReference(typeid2extendedtypeid(typeid(WaterConApplicationId))));<br />
//WaterConApplicationId is the EDT that is used to create the number sequence.<br />
info(numberSeq.num());<br />
<br />
numberSeq = numberSeq::newGetNum<br />
(NumberSeqReference::findReference(typeid2extendedtypeid(typeid(CustRelNo))));<br />
<br />
nextNo = numberSeq.num();<br />
<br />
//info(strfmt("%1",nextNo));<br />
<br />
ttscommit;<br />
}</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-12005637684045554372014-08-10T23:59:00.001-07:002014-08-11T00:00:24.277-07:00The server-side impersonated (RunAs) session tried to invoke a method that is available for client-side processing only.<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Solution:</b><br />
Follow these steps to solve the issue<br />
<br />
<ul style="text-align: left;">
<li>Open the RunBaseBatch Class in AOT>Classes.</li>
<li>Override the runsImpersonated() method.</li>
<li>replace return true; by return false;</li>
</ul>
<br />
This shall solve the problem.<br />
<br />
Thanks</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-31513784862521043832014-08-10T23:01:00.000-07:002014-08-12T07:48:49.746-07:00 Function to get last day of month in AX<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Code to find the last day of month in Ax.</b><br />
<b><br /></b>
static void LastOfMonth(Args _args)<br />
{<br />
TransDate transDate=today();<br />
TransDate LastOfMth;<br />
;<br />
<br />
//LastOfMth=endmth(mkdate(1,1,2014));//To enter date using business logic.<br />
LastOfMth=endmth(transDate);<br />
<br />
info(date2str(LastOfMth,123,2,2,2,2,4));<br />
}</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-71540812073789940972014-08-10T22:50:00.000-07:002014-08-10T22:50:24.188-07:00Moving object between layers.<div dir="ltr" style="text-align: left;" trbidi="on">
There is a very simple way to move objects between layers in AX.<div>
I will try to explain it using an example.</div>
<div>
<br /></div>
<div>
E.g. Moving objects from USR layer to CUS layer.</div>
<div>
<br /></div>
<div>
<b>Follow these steps:</b></div>
<div>
<ul style="text-align: left;">
<li>Logon to the USR layer.</li>
<li>Export the object that is suppose to be moved to CUS layer.</li>
<li>Now delete the object in the USR layer.</li>
<li>Logon to CUS layer.</li>
<li>Import the xpo from the USR layer in the CUS layer.</li>
</ul>
We have successfully moved the objects from USR layer to CUS layer.All the changes are on USR layer now for this object.</div>
<div>
<br /></div>
<div>
<span style="background-color: white;"><b style="color: red; font-style: italic;">Note: </b>Always start from uppermost layer(USR->SYS) when the changes are on multiple layers.Also it is a good practice to make a project in case of multiple objects.Same steps should be followed on the project.</span></div>
<div>
<span style="background-color: white;"><br /></span></div>
<div>
<span style="background-color: white;">Thanks</span></div>
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-50782270663556578472014-08-02T06:40:00.000-07:002014-08-24T05:09:13.503-07:00Ways to deploy SSRS Reports in AX 2012<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red;"><b>There are 3 ways to deploy a AX 2012 SSRS report.</b></span><br />
<br />
1)From Microsoft Dynamics AX(The reporting project needs to be added to AOT first for this option.)<br />
<br />
<ul style="text-align: left;">
<li>Open the <b>Development Workspace</b>.</li>
<li>Find the report you have to deploy in <b>SSRS Reports</b> <b>> Reports</b></li>
<li>Right-click and click <b>Deploy Element</b>.</li>
</ul>
<div>
<br /></div>
<div>
2)From Microsoft Visual Studio</div>
<div>
<ul style="text-align: left;">
<li>In the <b>Solution Explorer </b>right-click on the reporting project that contains the report.</li>
<li>Click <b>Deploy</b>.</li>
</ul>
<div>
<br /></div>
</div>
<div>
3)From Microsoft PowerShell</div>
<div>
<ul style="text-align: left;">
<li>This supports deploying multiple reports at a time.</li>
<li>For more details see <a href="http://trix2ax.blogspot.com/2014/08/deploying-ssrs-reports-using-powershell.html" target="_blank">AX 2012 PowerShell</a></li>
</ul>
<div>
<br /></div>
</div>
<div>
<span style="color: red;">Note:</span> The SSRS report that is created has to be deployed to the reporting server.Till then it is not available for the users.</div>
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-62783483334137332802014-07-30T09:53:00.002-07:002014-07-30T09:53:37.055-07:00Service could not start in timely fashion when trying to start AX 2012 service<div dir="ltr" style="text-align: left;" trbidi="on">
Hello all,<br />
<br />
You may encounter this issue when you are trying to begin a AX 2012 service.The service status is "starting" for long time with no response.<br />
<br />
<b>Solution:</b><br />
1)Wait for some time and check if the service begins.Just r-clk -> refresh.<br />
<br />
2)If the 1st solution didn't work for 10 mins or so then do the following :<br />
<br />
<ul style="text-align: left;">
<li>r-clk ->properties ->Log-on(Tab) ->this account</li>
<li>now browse and enter your login name</li>
<li>after that enter the correct password & confirm password.</li>
<li>It will say this changes will take effect only when the service restarts.</li>
<li>Now try stopping the service if it allows you to do so.</li>
<li>After stopping the service, start it again.This time the service should start successfully.(Do wait for the service to start even if it shows the same message again)</li>
<li>If the service is unable to stop then restart the system.Let the system load completely and wait for sometime so that the services start.This time the service should get into "started" status very soon.</li>
</ul>
<br />
<br />
In case of any doubts please add your queries to the comments.<br />
<br />
Thanks </div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-77369586675029452332014-07-29T22:18:00.001-07:002014-07-29T22:18:22.386-07:00virtualbox save machine state hangs at 100%<div dir="ltr" style="text-align: left;" trbidi="on">
This happens when you are trying to save a virtualbox machine with the "Save the machine state" option.<br />
<br />
Solution: Remove all the USB devices connected to the machine and then Save the machine state.<br />
<br />
Hope this helps!!!</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-47698161219492832292013-04-20T06:10:00.000-07:002013-04-20T06:11:29.383-07:00Restrict duplicate records in AX<b><span style="color: red; font-size: large;">In case you have a requirement where you are suppose to restrict the duplicate records.</span></b><br />
<br />
<u><span style="color: red;">E.g. :</span></u><br />
<u><span style="color: red;"><br /></span></u>
<br />
If in case you have 4 fields.<br />
And you require that any two same record values in the four or less columns should not repeat.<br />
<br />
You don't want same record(same combination) to be saved twice.<br />
<br />
<br />
<br />
Column: A B C D<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> amit <span class="Apple-tab-span" style="white-space: pre;"> </span>60 India emp<br />
yatish 60 India emp<br />
<span class="Apple-tab-span" style="white-space: pre;"> </span> amit<span class="Apple-tab-span" style="white-space: pre;"> </span> 60<span class="Apple-tab-span" style="white-space: pre;"> </span> India emp ****this record should not be saved<br />
<br />
<br />
Solution :<br />
<br />
1) Make new index to the table.<br />
2) Add the fields that you want to be added to the restricting combination.(Here all 4)<br />
3)Go to properties and set 'AllowDuplicates' to "No".<br />
<br />
This will restrict you from saving any duplicate combination in the table.<br />
<br />
Note: In case you need only A & B column without repeat then add only A & B fields to index.<br />
<br />Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-60742905816609140902013-04-20T05:21:00.000-07:002013-04-20T05:22:51.936-07:00Delete all transaction data for a specific company in AXI have noticed that sometimes we might need to delete all the transaction data for a particular company without altering the configuration data.This is possible in AX.<br />
<div>
<br /></div>
<div>
1)Login into AX in the company for which you want to delete the transaction data.</div>
<div>
2)Go to AOT.</div>
<div>
3)Open class SysDatabaseTransDelete</div>
<div>
4)Run it and Click 'YES' to delete all the transaction data in the current logged in company.</div>
<div>
<br /></div>
<div>
This might take few moments depending on the amount of data.<br />
<div>
<br /></div>
</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-79924708248575685852013-03-14T04:01:00.001-07:002013-04-20T05:25:53.040-07:00Lookup in AX<span style="color: red; font-size: large;">This is a small tutorial to setup lookup in ax.</span><br />
<span style="color: red; font-size: large;"><br /></span>
<span style="color: red; font-size: large;"><br /></span>
1)Create a new enum - Trix_Enum with 3 enum elements - ele1,ele2 & ele3<br />
<br />
2)Create a new EDT by name : Trix_EDT_Id<br />
<br />
3)Create a new table Trix_table with 4 fields :<br />
Trix_Id[datatype - Trix_EDT_Id]<br />
Trix_Name[datatype - Name]<br />
Trix_Type[datatype - Trix_Enum]<br />
Trix_amount[datatype - AmountMST]<br />
<br />
<br />
4) Go to AOT> EDT> Trix_EDT_Id<br />
Expand the relation node and create a Normal relation.<br />
Go to properties and select the source table in "Table" & source table field in "RelatedField"(E.g.Trix_Id)<br />
Save the changes.<br />
<br />
5)Go to the source table from which data should be lookup.<br />
Open the AutoLookup field group.<br />
Add the fields that need to be looked up.(E.g. Trix_Name,Trix_amount)<br />
<br />
6)Now use the EDT "Trix_EDT_Id" as edt for any new field.The new field will look up the source table(Trix_table) columns.(E.g. Here Trix_Id,Trix_Name,Trix_amount)<br />
<br />
7)Incase of Related field fixed relation it works as a where clause/condition and should be given on enums.<br />
Go to AOT> EDT> Trix_EDT_Id<br />
Expand the relation node and create a Related field fixed relation.<br />
Go to properties and select the source table field in "RelatedField"(E.g.Trix_Type) & enum value(E.g. 0,1,2) in "Value".<br />
Note: The condition is ANDed with the normal relation.Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com1tag:blogger.com,1999:blog-3392977842607694326.post-75166138428036806962013-03-13T23:12:00.001-07:002013-03-13T23:12:46.495-07:00Important functions in AX<span style="color: red; font-size: large;">Some useful Functions:</span><br />
<span style="color: red; font-size: large;"><br /></span>
curuserid();<br />
Function : Returns the user id of the current user.<br />
<br />
curext();<br />
Function : Returns the current logged in company.<br />
<br />
today();<br />
Function : Returns machine's current date.<br />
<br />
systemdateget();<br />
Function : Returns system application's current date.Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-41731278170159647322013-03-13T04:10:00.001-07:002013-03-13T23:16:07.035-07:00System does not support setup 'continuous' of number sequence<span style="color: red; font-size: large;">Solution:</span><br />
<div>
<span style="color: red; font-size: large;"><br /></span>
<div>
Some functions need to be called with a transaction processing.So just try using ttsbegin and ttscommit for the fuction call which is issuing the error.</div>
</div>
<div>
Mostly issued while using the number sequence.</div>
<div>
<br /></div>
<div>
E.g:</div>
<div>
<br /></div>
<div>
ttsbegin;</div>
<div>
<br /></div>
<div>
// statements giving error</div>
<div>
<br /></div>
<div>
ttscommit;</div>
<div>
<br /></div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-11740769596052101982013-03-13T00:21:00.001-07:002014-08-11T00:02:28.900-07:00Cannot select a record in (Table_name).Field_name: . The SQL database has issued an error.<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red; font-size: large;">Cause:</span><br />
There is a sync issue with the table on application and the database.<br />
<br />
<span style="color: red; font-size: large;">Solution:</span><br />
Go to /Administration/ SQL Administration<br />
Select the the table which is giving the error and press the button 'Table actions' > 'Check/Synchronize'.<br />
If this does not fix the issue try 'Index actions' > 'Reindex'</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-89452918352387198302013-03-12T23:54:00.001-07:002013-03-13T23:17:40.716-07:00"Journal has already been posted and, consequently, is not open"<span style="color: red; font-size: large;">Cause:</span><br />
<br />
The cause of this error is when you are trying to post a Journal which is already posted.This mostly happens when you are trying to post using X++ code.<br />
<br />
Check if you are passing new record(LedgerJournalTable) to Class LedgerJournalCheckPost everytime you call it for posting.<br />
<br />
First time you call the class the selected record gets posted but second time it is stopped in the validation process.As the record is already posted once.Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com2tag:blogger.com,1999:blog-3392977842607694326.post-71828903206721414672013-03-12T02:17:00.000-07:002013-03-12T02:17:15.746-07:00Bound,Unbound and Calculated Controls<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="color: red; font-size: large;">Bound controls:</span><br />
Bound controls are linked to the table and the information/data is saved(inserted/updated) to the database.Any control which has a datasource and a datafield in its properties is a bound control.<br />
<br />
<span style="color: red; font-size: large;">Unbound Controls:</span><br />
UnBound controls are not linked to the table and information will not be saved(inserted/updated) to the database.<br />
Use unbound controls to display pictures and static text.<br />
<br />
<span style="color: red; font-size: large;">Calculated controls:</span><br />
Calculated method uses a method as the data source.<br />
Usually display and edit methods are used in the data source of such controls.</div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0tag:blogger.com,1999:blog-3392977842607694326.post-26598259610601916242013-03-12T00:19:00.000-07:002013-04-20T05:00:23.044-07:00Box Class<div dir="ltr" style="text-align: left;" trbidi="on">
Boxes are mostly used for confirmation from the end user before executing business logic.<br />
<br />
<br />
There are many Box methods like:<br />
- info, warning, stop, yesNo, OkCancel etc<br />
<br />
Class which is used to create Boxes is "Box" and all the methods are static methods in this class.<br />
Box can be useful to beginners who are not used to the Debugger in AX as it can help them trace the path of code execution.<br />
<br />
Here is a example job for Box class:<br />
static void Trix_Box(Args _args)<br />
{<br />
;<br />
Box::info("This is an info box");<br />
<br />
Box::warning("This is a warning message");<br />
<br />
Box::stop("This is stop");<br />
<br />
if (Box::yesNo("Would you like to proceed", DialogButton::No, "A box example", "bottom text")<br />
== DialogButton::Yes)<br />
{<br />
info("Processing...");<br />
}<br />
else<br />
{<br />
throw error ("Process aborted");<br />
}<br />
<br />
<br />
info ("Process Complete");<br />
}<br />
<br /></div>
Yathttp://www.blogger.com/profile/09004384393696419646noreply@blogger.com0