January 05, 2015

X++ code to Customize Customer InvoiceId in the format of SI-YYMM#####

Hai,

Class used in this process is 

SalesInvoiceJournalCreateBase 

Method used is 

initJournalHeader()

comment this below line 

custInvoiceJour.InvoiceId= this.getJournalNumber();

and write the following code :

int HyphenPosition;

 

custInvoiceJour.InvoiceDate = this.updateDate();

 HyphenPosition=strFind(this.getJournalNumber(),'-',1,strLen(this.getJournalNumber()));

    custInvoiceJour.InvoiceId = subStr(this.getJournalNumber(),1,HyphenPosition)+
                                subStr(date2str(custInvoiceJour.InvoiceDate,321,2,0,2,0,2),1,4)+
                                subStr(this.getJournalNumber(),HyphenPosition+1,strLen(this.getJournalNumber())-HyphenPosition);

X++ code to get the Phone Number of the Delivery Address in the Purchase Order in AX 2012

static void getphoneNumber(Args _args)
{

PurchTable purchTable;

LogisticsLocation logisticslocation;

LogisticsPostalAddress logisticsPostalAddress;
   

select purchTable where purchTable.PurchId=="000020";

select logisticslocation where logisticslocation.ParentLocation =
LogisticsPostalAddress::findRecId(purchTable.DeliveryPostalAddress).Location;

info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Description);

info(LogisticsElectronicAddress::findByLocation(logisticslocation.RecId).Locator);