Skip to main content

Posts

Showing posts from 2013

How to stop manual Refresh (F5) on Forms in AX...?

Hi Friends, By doing a small code change in "SysSetupFormRun" class  we can stop the manual refresh(F5) on any form in AX. We need to add some code in "task( )" method. Ex :- public int task(int _p1) {     #task     FormDataSource formDataSource;     int ret;     if (_p1 == #taskFilter)     {         formDataSource = this.objectSet();         if (formDataSource &&             formDataSource.queryRun() &&             formDataSource.queryRun().args() &&             !formDataSource.queryRun().args().caller())         {             formDataSource...

How to add Filter functionality to Display method in dynamics AXAPTA

Hi Friends, Normally filters will work only in table fields but we can't do filters to display method. This below code will work for filters to display method also. Step 1: Go to the form design right click on particular control properties Auto Declaration No to Yes. Step 2: Override the context() method on the display method  . public void context() {     int             selectedMenu;     formrun         fr;     Args            ag;     Name            strtext;     querybuilddataSource qb1;     queryrun    qr;     query       q;     PopupMenu menu = new PopupMenu(element.hWnd());     int a = menu.insertItem('Filter By Field');     int b = menu.insertItem('Filter By Selection');     i...

How to pass control value in form to class in AXAPTA

How to pass control value from from to class in AX2009 Step :1 Write the method in Form level like : public str method1() {          return control.Text(); } Step 2: Write this code in class level where we need to use the value  if(formHasMethod(args.caller(), identifierStr(MethodName)))     {        strcustname =  args.caller().MethodName();        } Happy Daxing...!

Avoid warning message for "Empty compound statement" in AXAPTA

How to  avoid warning message like "Empty compound statement" in AXAPTA As: Simply call the below method inside your while loop or catch block to avoid best practice error Call exceptionTextFallThrough(); in the block. It does nothing, it's there just to say that you're intentionally not doing anything there (and to satisfy compiler). Happy Daxing.....

reRead( ) in AX 2009 - Best Advantage

Hi Friends, I hope all of you may already know about this, but I am forced to post it here. To avoid most of the UpdateConflicts / DeadLock errors while update a record in a table, just use the "reRead( )" method of the table before making any changes to the selected record of the table. Ex : ; ttsbegin; select forUpdate tSalesLine where tSalesLine.SalesId = = 'SO-1234567'; tSalesLine.reRead( ); tSalesLine.Feild1 = XXXXX; tSalesLine.Feild2 = XXXXX; tSalesLine.update( ); ttscommit; Happy Daxing.. AX Dude.

How to Cancel a Sales Order in AX using X++

Hi All, To cancel a sales order using X++ I tried the below code, I hope it will be helpful for you. ttsBegin;     while select forupdate salesLine         where salesLine.SalesId == salesTable.SalesId     {         salesLine.RemainInventPhysical = 0;         salesLine.RemainSalesPhysical  = 0;         salesLine.update();     } ttscommit; Happy Daxing, AX Dude

Finding out which tables were updated by an operation in AX

Hi All, At times when troubleshooting Microsoft Dynamics AX you need to know which tables were updated by a particular operation, for example after performing a posting. This could be if you want to be sure that all the right tables are updated correctly after an upgrade, if you have unexpected results on one customer/vendor etc or if you have made an update the system and you want to be sure that everything is ok. Click Here  to continue to the post. Happy Daxing, AX Dude

How to: Trace a Call to an AIF Web Service

Hi Guys, How to trace a call from an external client to an X++ service exposed as a Web service in Microsoft Dynamics AX. When you call the Web service, the call goes to the Web service and is then passed to the AOS. You can use tracing to capture the parameters the client sends to the Web services as well as the parameters that are sent from the Web service to the AOS. Click  here to see the content. Happy Daxing, AX Dude.

strLfix & strRfix Function - Append zeros to the String - AX 2009

Hi Folks, The following code used to append zeros to the string either left /Right. static void Append(Args _args) {     int i = 1;     str Append;     str finalResult;     ;     Append = strlFix(int2str(i), 5, "0"); // Create a string, with a length of 5, ending with the value of ''i'' and padded with zeros finalResult = strFmt("%1",  Append ); info(finalResult); } o/p:10000 Happy Daxing.....

Remove the characters from string and convert to date to str in Axapta

Hi Folks, strRem and date2str Below job are to explain about how remove the characters from date and time in axapta static void Job131(Args _args) {     str st;     ;     st = strRem(date2str(today(),213,2,0,2,0,4)+time2str(timenow(),                       TimeSeparator::Space,TimeFormat::Auto)," ");     info(st); } Normally date and time will display like 09/25/2013 07:14:30 Am By using date2str it will convert the date to str and again remove the character also . O/P:09252013071430am Thanks Happy Daxing...

Using File path on a form getting Error in Axapta

Hi Folks, After a long time am coming  back to posting few new things here for AX Developer... When we want to select the file path in form level. Normally what we will do create one EDT and extends with filepath (EDT), but that time when you are trying to select the path we will get error like stack-trace/Error message .Don’t worry there is no problem with your ax application. Simple we need to provide the method to the form like filepathLookUpTitle (). Below method we need to add it into form level methods, i.e. str filePathLookupTitle() {     return "Select document folder"; } Thanks Happy Daxing....

Create/Delete Customer using AIF Service Class in Dynamics AX without AIF Setup

Hi Guys, The Application Integration Framework allows us to create/update/delete or read data. Now in AX2009 we have a facility of creating/deleting records using AIF Service classes. There is "NO ADDITIONAL AIF SETUP"(Like Enabling Endpoints etc.) required to execute the code via service class. The services can be used to read/write data in AX. Click here  to see the cource page. Thanks, AX Dude.

Performance Analyzer for Microsoft Dynamics

Hi All,                     Performance Analyzer for Microsoft Dynamics (Performance Analyzer) is the tool used by Microsoft Dynamics support, Premier Field Engineers, and product team members to diagnose performance issues with Dynamics products. Click here to download Happy Daxing....! AX Dude.

How to uninstall SP1 from windows server 2008 r2 (KB: 976932)

Step 1 Login into windows server r2 , there go to command prompt with administrator rights (Run as administrator) Step 2 Type the cmd Wusa /uninstall /kb: 976932 and press enter uninstall bar will come it will take 10 to 15min to uninstall the server pack1 from server. Step 3 Using this commands we have to remove sp1 setup backup files from windows server OS 2008 r2 Dism.exe /online / Cleanup-Image /spsuperseded Happy Daxing..

How to avoid displaying negative values in the report in Axapta 2009 Using X++

Hi Friends, change negative sign to positive   in Axapta 2009 As: it’s very easy task, normally we will do it like go to property’s simply we will change the signdisplay = none Ex: Qty is -10 I want to display qty: 10 But here my requirement is wants to change the sign based on one condition in my Report. If that field is in display method I will write the condition and I will do it, it’s not a display method. This case we need to write the X++ code before sending data to body we need to write the Below single line of code: i.e. If (Table.SalesType == salestype::ReturnItem)  {         ( Control Name )Table_Qty. SignDisplay (signDisplay::None);   }                  Folks share your ideas,This my idea.. Happy  Daxing...                           ...

OpenPrinter_1: rc:0 lastError:1801(0x709) The printer name is invalid In Axapta 2009

When I open  the report getting the below in Dynamics AX 2009 Error message as below: "OpenPrinter_1: rc:0 lastError:1801(0x709) The printer name is invalid." Actually 2 places we need to Change First Place:       Classes->RunBaseReportDialog->main()  static void main(Args args) {     RunBaseReportDialog     reportDialog    = new RunBaseReportDialog(args.caller());     RunBaseReport           runBaseReport   = args.caller().runbase();     ReportRun               reportRun       = runBaseReport.reportRun();     Report                  report         ...

Display Method How Goto MainTable Functionality Works In Axapta 2009

Hi Friends, Recently i got requirement from my customer,that is very simple you know what is that,Customers is asking GotoMainTable Functionality for one field ,i.e display method: Just Simple Override JumpRef() under design ->Control -> public void jumpRef() {     Args args;     MenuFunction menuFunction;     SalesTable salesTableLocal;     str val2;     ;     super();     while select salesTableLocal where salesTableLocal.SalesId == SO.valueStr()     {                val2 = salesTableLocal.SalesId;                 args = new Args();                 //  args.caller(this);                 args.parm(val2);                 args.record(salesTableLocal);         ...

Dialog field lookup method

Hi ,   Dialog forms are extends with Runbase class or Runbasebatch class ,In this class dialog fields are added in dialog method for these dialog fields we can write a lookup method in below manner void Fld9_1_lookup()  {     Formrun fr = dialog.formRun();     object Control = fr.controlCallingMethod();     SysTableLookup       sysTableLookup = SysTableLookup::newParameters(tablenum(EmplTable),  dialogEmployee.fieldControl());     Query                query = new Query();     QueryBuildDataSource queryBuildDataSource;     queryBuildRange         maintenancesection;     ;     sysTableLookup.addLookupfield(fieldnum(EmplTable, EmplId));     SysTableLookup.addLookupMethod(identifierstr(name)); ...

How to send Normal AX Reports to User through Batch Process in Dynamics Ax 2009.

Hi friends, Recently I got one requirements from my User, I.e. customer want to see ax reports in E-mail everyday once through batch process. its just like send mail from batch process only, But we need to work on how to send normal report. 1) write the class with below methods mandatory.           2)Here am going to post logic for how to convert ax report to PDF and how to send the email to user only. // Saved the reports into particular location void SaveReport() {     Args args;     ReportRun rr;     str reportName = "OpenPurchOrderLine_Vendor";     str myPath;     int i;    ;    i = 1;   args = new Args(reportName);   args.caller(rr);   rr = new reportRun(args);     rr.query().interactive(false);     rr.report().interactive(false);   ...

Full Text Index in Dynamics AX 2012

Hi Friends, Full text index supports to quickly query words that are embedded in the middle of a string field of a table. Well, this is a very nice enhancement to query on Database table fields for the developers who work with the latest vesion [Microsoft Dynamics AX 2012] Good thing is we can use this Index on Memo fields and also Extended data type. Let me explain with an example. Create a new table as shown below and add a new field of type string “Name” to it – On the field use EDT – Name. In the below example, my table Name is SR_FullTextExample. Once you are done with your table, Go to FullTextIndex Node >> Right click and create a new FullTextIndex. Rename it to NameFullTextIndex. Drag and drop Name field from the fields to the newly created index. The table with index should look like below. The following X++ Job uses a full text index that exists on a table and field that it queries. static void FullTextExamp(Args _args) { ...

How to retrieve multiple selected records from Grid using X++ in Axapta

Hi Friends, In this post, we discuss how we can retrieve all selected(marked) records of a datasource or retrieve marked records form Grid. For this purpose follow the steps listed below. Create a new table named " TabPet " that contains two string fields i.e. Name & ID. Create a new form and add the newly created "Student" table in the datasource node. Next create a new button on the form, set its multiselect property to " Yes " . Now override the clicked method of the button and add the following code. Code snippet     int             recordsCount;     TabPet      TabpetLocal;     super();          recordsCount =  TabPet  _ds.recordsMarked().lastIndex();  // Total number of marked records.      TabpetLocal =  TabPet _ds.getFirst(1);          while ( TabpetLocal )     {         info( Tabp...

Convert word Documents into PDF report [using X++ in Dynamics AX 2009]

Hi Friends, This is the way we can convert word format report into PDF in ax2009 static void dsiple_PDS(Args _args) {     Args args;     ReportRun rr;     str reportName = "ReportName";     PurchRFQLine rfqLineTable;     str myPath;     str pdfFileName;     int i;     COM wordApplication;     COM wordDocuments;     COM wordDocument;     COM wordRange;     str a[];     str path;     str pdfPath;     str finalPath;     int length;     int minus;     ;     i = 1;     myPath = winApi::getTempPath();     info(myPath);     args = new Args(reportName);     args.caller(rr);     //rr =...