X++ Cheat Sheet

This is just a collection of my commonly used algorithms, global functions etc in x++, they don’t really have that much to do with workflow in specific

Currency

//Getting exchange rate to base currency: e.g. 
ExchRateHelper::getExchRate_Static(purchreqline.CurrencyCode, today());

//Convert to base currency: e.g.
Currency::amountCur2MST(purchreqLine.LineAmount, purchreqLine.currencyCode);

Date

//Today's date e.g.
date(); //Returns date only

//Time Now
timeNow();

EmplId to UserId

SysCompanyUserInfo::emplId2UserId([EMPLID]);

Eventing (AX 2012)

Modifying parameters and return values

static public void preEvent(XppPrePostArgs ppArgs)
{
ppArgs.setArg("_myParam", "New Value");
}
static public void postEvent(XppPrePostArgs ppArgs)
{
ppArgs.setReturnValue("Returned value");
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: