Skip to main content

Posts

Send mail via populate the outlook client by code in MSD axapta

To Send mail via populate the outlook client by code in axapta #ObjOutlookCOMDEF #define.outlook("Outlook.Application") #define.mapi("MAPI") COM ObjOutlook; COM ObjOutlookNameSpace; COM ObjOutlookMailItem; COM ObjOutlookAttachment; COM ObjOutlookRecipient; ; ObjOutlook = new COM(#outlook); ObjOutlookNameSpace = ObjOutlook.getNamespace(#mapi); ObjOutlookNameSpace.logon(); ObjOutlookMailItem = ObjOutlook.CreateItem('Outlook.OlItemType.olMailItem'); ObjOutlookMailItem.To("sksinght@abc.com"); ObjOutlookMailItem.Subject("Testing"); ObjOutlookAttachment = ObjOutlookMailItem.Attachments(); ObjOutlookAttachment.Add(@"d:\xyz.pdf",1,1,"New"); ObjOutlookMailItem.save(); ObjOutlookMailItem.display(); info("Activity launched in Microsoft Outlook"); ObjOutlookNameSpace.logoff();

How to insert tableid using Insert recordset in MSD axapta

How to insert tableid using Insert_recordset. Its work on latest version of dynamics ax only. int tab2 = tableNum(Table2); insert_recordset TABLE(RefRecId, RefTableId) select recId, tab2 from Table2 Syntax.. insert_recordset NameOfTable(field1, field2,field3,field4,field5) select field1, field2,field3,field4,field5 from RecOfTable where Concolm<=299999; //In SQL you can execute this way to work faster. SELECT * INTO table2 FROM table1;

How to remove special characters from string in MSD axapta

To remove special characters from string in axapta you can try following code . static void formatedString(Args _args) { str StringVal = “ Hello \tSumit \n Dear”; str replace(str _sourceStr, str _what, str _with) { int found = 0; str target = _sourceStr; ; do { found = strscan(TargetStr, _what, found, strlen(TargetStr)); if (found != 0) { TargetStr = strdel(TargetStr, found, strlen(_what)); TargetStr = strins(TargetStr, _with, found); found += strlen(_with); } } while (found != 0); return TargetStr; } ; StringVal = replace(StringVal, ‘\n’, ”); StringVal = replace(StringVal, ‘\r’, ”); StringVal = replace(StringVal, ‘\t’, ”); StringVal = replace(StringVal, ‘ ‘, ”); info(StringVal); }

Add sort field on grid using form datasource in MSD axapta

To Add sort field on grid using form data source in axapta  you can do following code in form data source table on execute query method. public void executeQuery() {; InventTable_ds.query().dataSourceNo(1).sortClear(); InventTable_ds.query().dataSourceNo(1).addSortField(fieldNum(CustTable,CustGroup), sortOrder::Ascending); super(); } After adding code you can call in modified method of control or init method of form. public boolean modified() { boolean ret; ; ret = super(); InventTable_ds.executeQuery(); return ret; }

ttsBegin and ttsCommit in MSD axapta

You can use ttsbegin and ttscommit with ttsabort following way. You can try in job public boolean myMethod() { try { ttsBegin; select forUpdate myTable; myTable.fname = testt_; myTable.update(); ttsCommit; } catch(exception::Error) { ttsabort; return(false); } return(true); }