01 December 2016

AXBuild for parallel compile | AX 2012 Command prompt compilation | AxBuild.exe for Parallel Compile on AOS of X++ to p-code

AXBuild for parallel compile | AX 2012 Command prompt compilation | AxBuild.exe for Parallel Compile on AOS of X++ to p-code

Open the command prompt using admin rights:

C:\Program Files\Microsoft Dynamics AX\60\Server\MicrosoftDynamicsAX\bin>
axbuild.exe xppcompileall /s=01 /altbin="C:\Program Files (x86)\Microsoft Dynamics AX\6.0\Client\Bin"

Please click here for more information

The CIL generator found errors and could not save the new assembly in AX 2012

"The CIL generator found errors and could not save the new assembly"


The following should resolve the problem:
Full compile AX 
Stop the AOS 
Delete all records from the SysXPPAssembly table in SQL (the table is used to contain the assemblies and to share between multiple AOS instances) 
Delete the DLL and netmodule files in your AOS's bin\xppIL directory 
Restart the AOS 
Perform full CIL generation

31 October 2016

Print management does not show the new report design in AX 2012

We have to add the code to populate the new design : PrintMgmtReportFormat.populate()
Ex:
public server static void populate()
{
.
.
.
.
.

addOther(PrintMgmtDocumentType::Quotation,'SalesQuotation.Report_FR','SalesQuotation.Report_New',#NoCountryRegionId);
ttscommit;
.
.
.
}

27 October 2016

How to get Site contact details / Electronic address / Phone Email in AX 2012

Please refer the below image that will help to under relation between related tables.

static void inventSiteElectronicAddress(Args _args)
{
InventSite inventSite;
InventSiteLogisticsLocation inventSiteLogisticsLocation;
LogisticsLocation logisticsLocation;
LogisticsElectronicAddress logisticsElectronicAddress;

inventSite = InventSite::find("ARNAGE"); // ARNAGE is the inventsite name

select firstonly inventSiteLogisticsLocation
where inventSiteLogisticsLocation.Site == inventSite.RecId
join firstonly logisticsLocation
where logisticsLocation.ParentLocation == inventSiteLogisticsLocation.Location
join firstOnly logisticsElectronicAddress
where logisticsElectronicAddress.Location == logisticsLocation.RecId
&& logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Phone
&& logisticsElectronicAddress.IsPrimary == NoYes::Yes;

info(logisticsElectronicAddress.Locator);
}

25 October 2016

how to get Dimension Value using Default dimension in AX 2012

Option 1:

DimensionAttributeValueSetStorage    dimStorage;
str dimval;

dimval = DimensionAttributeValueSetStorage::find(salesQuotationTable.DefaultDimension).getDisplayValueByIndex(2);
info(strFmt("%1",dimval));

Option 2:

public void financialDimValue(Name _attributeName)
{
    DimensionAttributeValueSet          ceDimensionAttributeValueSet;
    DimensionAttributeValueSetItem      ceDimensionAttributeValueSetItem;
    DimensionAttributeValue             ceDimensionAttributeValue;
    DimensionAttribute                  ceDimensionAttribute;
    ;

    select RecId from ceDimensionAttributeValueSet
        where  ceDimensionAttributeValueSet.RecId == salesQuotationTable.DefaultDimension
    join RecId, DisplayValue from ceDimensionAttributeValueSetItem
        where ceDimensionAttributeValueSetItem.DimensionAttributeValueSet == ceDimensionAttributeValueSet.RecId
    join RecId from ceDimensionAttributeValue
        where ceDimensionAttributeValue.RecId == ceDimensionAttributeValueSetItem.DimensionAttributeValue
    join RecId, Name from ceDimensionAttribute
        where ceDimensionAttribute.RecId == ceDimensionAttributeValue.DimensionAttribute
        && ceDimensionAttribute.Name == _attributeName;

    inventSite          =   InventSite::find(ceDimensionAttributeValueSetItem.DisplayValue);
}

13 October 2016

AX 7 & AX 2012 How to get default address for the same type of address Like Delivery

When there are Delivery type address are multiple to get default address:
Below is the class to use to get Default address.

Class: LogisticsLocationDefault

Reference: code:

\Data Dictionary\Tables\SalesTable\Methods\initFromCustTableMandatoryFields

location = LogisticsLocationDefault::findSimpleDefault(custTable, LogisticsLocationRole::findBytype(
LogisticsLocationRoleType::Delivery));

29 September 2016

String length align to export in Notepad AX 2012

public str strAlign(str _string, int _length)
{
str ret;

ret = _string + strRep(' ', _length);
ret = subStr(ret, 1, _length);

return ret;
}

27 July 2016

Get Dimension attribute value for Customer creation and for journal lines

Struct struct = new Struct();
container ledgerDimension;
DimensionDefault DimensionDefault;

custTable.company(custTableStagging.LegalEntity);
custTable.initValue();
name = custTableStagging.FirstName + " "+ custTableStagging.LastName;
//CustTable
custTable.AccountNum = NumberSeq::newGetNum(CustParameters::numRefCustAccount()).num();//customer.parmAccountNum();
custTable.CustGroup = custTableStagging.CustGroup;
custTable.Currency = CompanyInfo::standardCurrency();
if (custTableStagging.Region != '')
{
struct.add('Region', custTableStagging.Region);
ledgerDimension += struct.fields();
ledgerDimension += struct.fieldName(1);
ledgerDimension += struct.valueIndex(1);
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
custTable.DefaultDimension = DimensionDefault;
}

// custTable.KPMGPayeeName = name;
custTable.insert(DirPartyType::Organization, name);
============


container cont1,cont2,offSetAcctPattern;
int cnt;
DimensionDynamicAccount ledgerDim, offsetledgerDim;

if(mLegalEntity != '')
{
cnt++;
cont2 += ['LegalEntity',mLegalEntity];
}
if(mLocationFacility != '')
{
cnt++;
cont2 += ['LocationFacility',mLocationFacility];
}
if(mDepartment != '')
{
cnt++;
cont2 += ['Department',mDepartment];
}
if(mCustomerGroup != '')
{
cnt++;
cont2 += ['CustomerGroup',mCustomerGroup];
}
if(mBusinessUnit != '')
{
cnt++;
cont2 += ['BusinessUnit',mBusinessUnit];
}
if(mLocationType != '')
{
cnt++;
cont2 += ['LocationType',mLocationType];
}
if(mCompetency != '')
{
cnt++;
cont2 += ['Competency',mCompetency];
}
if(mProject != '')
{
cnt++;
cont2 += ['Project',mProject];
}

if(mRegion != '')
{
cnt++;
cont2 += ['Region',mRegion];
}
if(mWorker != '')
{
cnt++;
cont2 += ['Worker',mWorker];
}

if(ledgerJournalTrans.AccountType == LedgerJournalACType::Ledger)
{
cont1 += ['MainAccount',AccountNumb,cnt];
cont1 += cont2;
ledgerDim = AxdDimensionUtil::getLedgerAccountId(cont1);

if(ledgerDim == 0)
{
offSetAcctPattern = [AccountNumb,AccountNumb];
ledgerDim = AxdDimensionUtil::getLedgerAccountId( offSetAcctPattern);
}

ledgerJournalTrans.LedgerDimension = ledgerDim;
}
else
{
ledgerDim = DimensionStorage::getDynamicAccount(AccountNumb,ledgerJournalTrans.AccountType);
ledgerDimension += cnt;
ledgerDimension += cont2;
DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
ledgerJournalTrans.LedgerDimension = ledgerDim;
LedgerJournalTrans.modifiedField(fieldNum(LedgerJournalTrans,LedgerDimension));
ledgerJournalTrans.DefaultDimension = DimensionDefault;

24 June 2016

X++ code to generate ledger voucher number sequence in AX 2012


NumberSeq numberSeq;
NumberSequenceTable numSeqTable;
Voucher voucher;

select firstOnly numSeqTable
where numSeqTable.RecId == LedgerJournalName::find(ledgerJournalTable.JournalName).NumberSequenceTable;
if (numSeqTable && !voucher)
{
numberseq = numberseq::newGetVoucherFromCode(numSeqTable.NumberSequence);
voucher = numberseq.voucher();
}

ledgerJournalTrans.Voucher = voucher;

12 May 2016

SSRS Report RDP class with process report method - Query in process report with multiple tables

[SysEntryPointAttribute(false)]
public void processReport()
{
Query query;
QueryRun queryRun;
QueryBuildRange vendAccountRange;
QueryBuildRange fromDateRange;
QueryBuildRange toDateRange;
QueryBuildRange incoTermsRange;
QueryBuildRange cTMLocationIdRange;
QueryBuildRange cTMItemIdRange;
QueryBuildRange WMSCarrierNameRange;

QueryBuildRange approvedContractRange;
QueryBuildRange locationRange;
QueryBuildrange commodityRange;
QueryBuildRange contractTypeRange;
QueryBuildDataSource qbds;
QueryBuildDataSource qbds1
,qbds2
,qbds3
,qbds4;
QueryBuildDataSource qbds_load;
QueryBuildLink queryBuildLink;

CTMContractLoads ctmContractLoads;
CTMContractOnCost ctmContractOnCost;
CTMContractLines ctmContractLines;
CTMMIHeader ctmMIHeader;
CTMContractHdr ctmContractHdr;
CTMMILine ctmMILine;

UOMLogisticsContract2 contract;
VendTable vendTable;
CTMCustVendName ctmCustVendName; // origin Name
VendAccount vendAccount;
CTMDeliveryFromDate ctmDeliveryFromDate; // delivery from date
CTMDeliveryToDate ctmDeliveryToDate; // delivery to date
CTMLogisticStepStatus ctmLogisticStepStatus; // status
CTMIncoTermsCode ctmIncoTermsCode; // Inco Terms
CTMLocationId ctmLocationId;
CTMLocationId shipTo;
WMSCarrierName vendAccountHau; // Haulier
CTMItemId ctmItemId; // Commodity
CTMContractId contractId;

;

contract = this.parmDataContract() as UOMLogisticsContract2;
query = this.parmQuery();

qbds = query.dataSourceTable(tableNum(VendTable));
qbds1 = query.dataSourceTable(tableNum(CTMContractLoads));
qbds2 = query.dataSourceTable(tableNum(CTMMIHeader));
qbds3 = query.dataSourceTable(tableNum(CTMMILine));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));
//qbds1 = query.dataSourceTable(tableNum(CTMContractLoadsForm));

vendAccount = contract.parmOriginName(); // done
ctmDeliveryFromDate = Contract.parmDeliveryFromDate();// done
ctmDeliveryToDate = contract.parmDeliveryToDate();// done
ctmLogisticStepStatus = contract.parmStatus(); // done
ctmIncoTermsCode = contract.parmIncoTerms();
// cTMLocationId = contract.parmDe
ctmLocationId = contract.parmPickUpLocaton(); // done
vendAccountHau = contract.parmHaulier(); // done
ctmItemId = contract.parmComodity(); // done
//shipTo = contract.parmShipTo();

if(vendAccount)
{
vendAccountRange = SysQuery::findOrCreateRange(qbds,fieldNum(VendTable,AccountNum));
vendAccountRange.value(vendAccount);
}

if(vendAccountHau)
{
WMSCarrierNameRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,carrier));
WMSCarrierNameRange.value(vendAccountHau);
}

if(cTMLocationId)
{
cTMLocationIdRange = SysQuery::findOrCreateRange(qbds1,fieldNum(CTMContractLoads,DeliveryLocation));
cTMLocationIdRange.value(cTMLocationId);
}

if(cTMItemId)
{
cTMItemIdRange = SysQuery::findOrCreateRange(qbds1,fieldNum(CTMContractLoads,PurchaseCommodity));
cTMItemIdRange.value(cTMItemId);
}


if(cTMDeliveryFromDate)
{
fromDateRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,DeliveryFromDate));
fromDateRange.value(SysQuery::range(cTMDeliveryFromDate,dateNull()));
//vendAccountRange.value(cTMDeliveryFromDate);
}
if(cTMDeliveryToDate)
{
toDateRange = SysQuery::findOrCreateRange(qbds2,fieldNum(CTMMIHeader,DeliveryToDate));
toDateRange.value(SysQuery::range(dateNull(),cTMDeliveryToDate));
}

queryRun = new queryRun(query);

while ((queryRun.next()))
{
vendTable = queryRun.get(tableNum(VendTable));
ctmContractLoads = queryRun.get(tableNum(CTMContractLoads));
ctmMIHeader = queryRun.get(tableNum(CTMMIHeader));
ctmContractOnCost = queryRun.get(tableNum(CTMContractOnCost));
ctmMILine = queryRun.get(tableNum(CTMMILine));

select firstOnly ctmContractHdr
where ctmContractLoads.PurchaseContract == ctmContractHdr.ContractId;

this.insertIntoLogisticsTMP(
vendTable
,ctmContractLoads
,ctmMIHeader
,ctmContractOnCost
,ctmMILine
,ctmContractHdr
);
}

}

==========

SSRS Report design - >
Parameters Change proeperty
Allow Blank: True
Nullable: True

26 April 2016

Pass the record from to class in ax 2012

LedgerJournalTable Form Button:

void clicked()
{
Args args = new Args();
VendInvoiceJournalLineImport invoicejournalimport
;
args.record(LedgerJournalTable);
invoicejournalimport = new VendInvoiceJournalLineImport();
invoicejournalimport.run(args);
LedgerJournalTrans_ds.executeQuery();
}

Class:

public void run(Args _args)
{
ledgerJournalTable = _args.record() as ledgerJournalTable;
dialog = new dialog('Excel Import');

dialogfield = dialog.addField(extendedTypeStr(FilenameOpen), 'File Name');
dialog.run();
if(dialog.run())
{
filename = (dialogfield.value());
application = SysExcelApplication::construct();
workbooks = application.workbooks();
if(filename)
{
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error('File cannot be opened.');
}
this.dataImport();
}
}
}

21 March 2016

Dynamics AX 7 List of Courses for technical at partner sources and Dynamics Learning Portal - DLP

List of AX 7 courses available at partner source and DLP.


80730AE: Development Basics in Microsoft Dynamics AX

80732AE: Introduction to Microsoft Dynamics AX

80753AE: Microsoft Dynamics ‘AX 7’ Security

80754AE: Microsoft Dynamics 'AX 7' Performance, Reliability and Scale

80755AE: An Introduction to the Microsoft Dynamics 'AX 7' User Experience

80757AE: Monitoring and Diagnostics of Microsoft Dynamics 'AX 7' Environment

80758AE: Microsoft Dynamics 'AX 7' Office Integration to Enhance User Productivity

80759AE: Microsoft Dynamics Lifecycle Services Solutions Overview

80760AE: Microsoft Dynamics 'AX 7' Data Management Story

80763AE: Navigating Microsoft Dynamics AX

80764AE: Introduction to Microsoft Dynamics AX for Retail

80765AE: Introduction to the Microsoft Dynamics AX System Architecture and Technology

80766AE: Introduction to Microsoft Dynamics AX Reporting and Analytics

80767AE: Introduction to Case Management in Microsoft Dynamics AX

80768AE: Introduction to Microsoft Dynamics AX Workflow

80769AE: Introduction to the Task Recorder in Microsoft Dynamics AX

80770AE: Introduction to Microsoft Office Integration with Microsoft Dynamics AX

80771AE: Introduction to System Administration in Microsoft Dynamics AX

80772AE: Introduction to the Organizational Model in Microsoft Dynamics AX

02 February 2016

Dynamics AX 7 Release date

HI All,

Microsoft Dynamics AX7 is going to release in this year.
Coming Soon...


AX 2012 Financial Dimension main tables and relations

Hi,

Below are the financial dimension tables and relations:

DimensionAttribute -> RecId

DimensionAttributeValue.DimensionAttribute == DimensionAttribute.RecId

DimensionAttributeValue.Owner == HcmWorker.RecId

DimensionAttributeValueSetItem.DimensionAttributeValue == DimensionAttributeValue.RecId

DimensionAttributeValueSetItem.DimensionAttributeValueSet == DimensionAttributeValueSet.RecId

Dimension value View:
DimensionAttributeValueSetItemView

Happy Daxing :-)

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension-...