Skip to main content

Posts

How to convert Amount in Accounting currency in Ax 2012

To convert Amount in Accounting currency in Ax 2012 you can take help of below code, first you need to find accounting currency then you can pass the value of currency using method calculatecurrencytocurrency . Here an example to convert delivery remainder to accounting currency. Ledger ledger; Currencycode accCurrency; CurrencyExchangeHelper currencyExchangeHelper; AmountMst amountMST; select ledger where ledger.PrimaryForLegalEntity == CompanyInfo::findByCompany_IN(curext()).RecId; accCurrency = ledger.AccountingCurrency; currencyExchangeHelper = CurrencyExchangeHelper::newExchangeDate(Ledger::current(), systemDateGet()); amountMST = currencyExchangeHelper.calculateCurrencyToCurrency(this.CurrencyCode , accCurrency ,1 , true); return this.SalesPrice * this.RemainSalesPhysical * amountMST;

Auto Submit Workflow for Approval in Ax 2012

Sometimes we need to submit Auto Submit Workflow for Approval in Ax 2012 then you can try below code by job. One thing you need to remember submitter should not be approval in workflow designer if its then this job may create some issue on approval. Rest is fine you can use this code for your customization. Inventtable inventtable =InventTable::find("628034tr1"); Workflow::activateFromWorkflowType("InventApprWFType", //Template name inventtable.RecId, //Record id of the document that you are submitting, 'Auto-Submitted into workflow', //A comment for the workflow history to know something about how this was submitted, false,//This document wasn't submitted from the web, 'userid1'); // T info("done");