Skip to main content

Posts

How to call job to another job in MSD axapta using x++ code

How to call job to another job in axapta using x++ code 1. Create simple job job_test  and add it to action menu item in AOT. 2. Call job_test in other job using following code.    Args                    args;     ;         args = new Args();     args.name(identifierStr(Jobs_Test));     new menuFunction(menuItemActionStr(Jobs_Test), MenuItemType::Action).run(args); If you want to add job in action menuitem then just right click on aot menuitem on action type then create new menuitem. After that you can set that job in object selection property of menuitem.  You can not direction drag job to action menuitem.

Simple Example of using tables in Query in MSD axapta Reprts

Simple Example of using tables in Query in axapta Reprts     Query q;     QueryRun qr;     QueryBuildDatasource qbds;     QueryBuildRange qbr;    InventTable inventtab;     ;     q = new Query();     qbds = q.addDataSource(tablenum(InventTable));     qbr = qbds.addRange(fieldNum(InventTable,Status));     qbr.value(queryValue(NoYes::No));     qr = new SysQueryRun(q);     while(qr.next())     {     inventtab = qr.get(tableNum(InventTable));     info(inventtab.Itemid);     }

Code to send email with attachment using dynamics MSD axapta x++

Code to send email with attachment using dynamics axapta x++ void SendEMail() {     System.Net.Mail.MailMessage              Message;     System.Net.Mail.Attachment              attachment;     System.Net.Mail.AttachmentCollection    attachementCollection;     System.Net.Mail.SmtpClient              smtpClient;     System.Net.Mail.MailAddress             emailfrom;     System.Net.Mail.MailAddress             emailto;     str                                     messageBody ;     str                                     Subject;     str                                     SMTPServer;     str                                     Filenm;     FileIOPermission                        permission1;     ;     emailfrom = new System.Net.Mail.MailAddress(" From@xyz.com ","");     mailAddressTo = new System.Net.Mail.MailAddress(" To@abc.com ","");     messageBody = "This is test mail";     Subject = "Subject";     SMTPS

Add tables to query build datasource in MSDAX

Add tables to query build datasource ,addlink,relation static void QBDSExample(Args _args) { Query query; QueryBuildDatasource datasource; ; query = new Query(); // Add purchtable main datasource datasource = query.addDataSource(tableNum(purchtable)); // Add child datasource "purchline" datasource = datasource.addDataSource(tableNum(purchline)); // Set the join mode datasource.joinMode(JoinMode::InnerJoin); datasource.relations(false); datasource.addLink(fieldNum(purchtable, purchid), fieldNum(purchline, purchid)); info(query.xml()); }

How to get all table ids from AOT using dynamics MSD axapta x++ code

You can write following code  to get all table ids from AOT using dynamics axapta x++ language. Axapta is developed on .Net platform and its object base programming. You need to understand object concept before starting programming in axapta. You can declare object for tables,forms,reports,class,views etc . //variable declaration Dictionary dictionary1; TableId tableId1; ; // initialize object dictionary1 = new Dictionary(); // set initial table id tableId1 = dictionary.tableNext(0); // start table id loop while (tableId1) { info(int2str(tableId1)); tableId1 = dictionary1.tableNext(tableId1); } // end table id loop