Hi the below code help you to insert custom created field values from a journal(LedgerJournalTrans) to the vendTrans table.
The insertion and updation of the vendTrans fields is done with the help of CustVendTrans Map
Follow the below setups when you add a new field to the ledgerJournalTrans and update it to vendTrans table...
1. Add the field to the custVendTrans Map - before that add field to ledgerJournalTrans and vendTrans.
2. Create a new mapping in the VendTrans of custVendTrans Map
CustVendTrans.ProjId == VendTrans.ProjId
3. Class - CustVendVoucher
In the Class declaration add a variable
ProjId updateProjId;///Kranthi
4. Add a new method to CustVendVoucher class
ProjId parmUpdateProjId(ProjId _projId = updateProjId)
{
;
updateProjId = _projId;
return updateProjId;
}
5. In the initCustVendTrans methid of CustVendVoucher class add this line
custVendTrans.ProjId = updateProjId;
6. Class - VendVoucher -> in the newVendVoucherJournal method of vendVoucher class place the below line of code
vendVoucher.parmUpdateProjId(_ledgerJournalTrans.ProjId);
7. Compile the two classes
Hope this code will help you...
Sunday, January 9, 2011
Friday, December 24, 2010
Importing an XPO through code
This code helps to import an XPO using X++
static void importXPO(Args _args)
{
SysImportElements sysImportElements = new SysImportElements();
;
sysImportElements.newFile("C:\\Form_KranthiTest.xpo");/// this is your XPO filename
sysImportElements.parmImportAot(true);
sysImportElements.parmImportWithIds(false);///if you don't to import with IDvalues
sysImportElements.import();
}
static void importXPO(Args _args)
{
SysImportElements sysImportElements = new SysImportElements();
;
sysImportElements.newFile("C:\\Form_KranthiTest.xpo");/// this is your XPO filename
sysImportElements.parmImportAot(true);
sysImportElements.parmImportWithIds(false);///if you don't to import with IDvalues
sysImportElements.import();
}
Monday, December 13, 2010
Sending mails through outlook
This code open an mail window form - to which you can send parameters like email id , subject and body
static void sendEmailThroughOutlook(Args args)
{
SmmOutlookEMail smmOutlookEMail = new SmmOutlookEMail();
Object smmSendEmail;
;
args = new Args();
args.name(formstr(smmSendEmail));
args.caller(smmOutlookEMail);
smmSendEmail = classfactory.formRunClass(args);
if (smmSendEmail)
{
smmSendEmail.init();
smmSendEmail.setEmailTos("aaa@gmail.com");
smmSendEmail.setEmailSubject("Kranthi");
smmSendEmail.setAttachments(["C:\AIF\kranthi.txt"]);
smmSendEmail.run();
smmSendEmail.refreshControl();
smmSendEmail.wait();
}
}
static void sendEmailThroughOutlook(Args args)
{
SmmOutlookEMail smmOutlookEMail = new SmmOutlookEMail();
Object smmSendEmail;
;
args = new Args();
args.name(formstr(smmSendEmail));
args.caller(smmOutlookEMail);
smmSendEmail = classfactory.formRunClass(args);
if (smmSendEmail)
{
smmSendEmail.init();
smmSendEmail.setEmailTos("aaa@gmail.com");
smmSendEmail.setEmailSubject("Kranthi");
smmSendEmail.setAttachments(["C:\AIF\kranthi.txt"]);
smmSendEmail.run();
smmSendEmail.refreshControl();
smmSendEmail.wait();
}
}
Tuesday, November 30, 2010
Which Report Template does the Auto Report Uses?
The Ax will use "FrontPage" report template for Auto Report.
Thursday, November 25, 2010
Download Project Time Management for AX 2009
Here is the link for downloading the Project Time Management for Microsoft Dynamics AX 2009 from partner source.
https://mbs.microsoft.com/partnersource/support/selfsupport/productreleases/ax2009projecttime.htm?printpage=false
https://mbs.microsoft.com/partnersource/support/selfsupport/productreleases/ax2009projecttime.htm?printpage=false
Monday, November 22, 2010
Changing Production Order Status to started
Here is a simple code which changes the production order status to started.
If your production module is setup-ed to post the PickingListJournal
automatically when the production is started - the code help you to post
even the picking list journal automatically.
prodTable = ProdTable::find("PRD_00000588");////pass your prodId
prodTable.autoUpdate(ProdStatus::StartedUp);
you cannot extend this to other status like ReportAsFinished and Ended
If your production module is setup-ed to post the PickingListJournal
automatically when the production is started - the code help you to post
even the picking list journal automatically.
prodTable = ProdTable::find("PRD_00000588");////pass your prodId
prodTable.autoUpdate(ProdStatus::StartedUp);
you cannot extend this to other status like ReportAsFinished and Ended
Saturday, November 20, 2010
Using DictClass
The below code is used to print number of methods in a Class ans even their names.
The same code can be extended to all other objects like DictTable class for tables,
dictEnum class for enums etc...
static void dictClass(Args _args)
{
int noOfMethods,i;
DictClass dictClass = new DictClass(ClassNum(InventMovement));
/// InventMovement is the Class
;
noOfMethods = dictClass.objectMethodCnt();
for(i = 1 ; i <= noOfMethods ; i++)
{
info(strfmt("%1. InvemntMovment - %2",i,dictClass.objectMethod(i)));
}
pause;
}
By using DictClass you can also print the number of Static methods and their names.
static void dictClassStatic(Args _args)
{
int noOfMethods,i;
DictClass dictClass = new DictClass(ClassNum(InventMovement));
;
noOfMethods = dictClass.staticMethodCnt();
for(i = 1 ; i <= noOfMethods ; i++)
{
info(strfmt("%1. InvemntMovment - %2",i,dictClass.staticMethod(i)));
}
pause;
}
The same code can be extended to all other objects like DictTable class for tables,
dictEnum class for enums etc...
static void dictClass(Args _args)
{
int noOfMethods,i;
DictClass dictClass = new DictClass(ClassNum(InventMovement));
/// InventMovement is the Class
;
noOfMethods = dictClass.objectMethodCnt();
for(i = 1 ; i <= noOfMethods ; i++)
{
info(strfmt("%1. InvemntMovment - %2",i,dictClass.objectMethod(i)));
}
pause;
}
By using DictClass you can also print the number of Static methods and their names.
static void dictClassStatic(Args _args)
{
int noOfMethods,i;
DictClass dictClass = new DictClass(ClassNum(InventMovement));
;
noOfMethods = dictClass.staticMethodCnt();
for(i = 1 ; i <= noOfMethods ; i++)
{
info(strfmt("%1. InvemntMovment - %2",i,dictClass.staticMethod(i)));
}
pause;
}
Subscribe to:
Posts (Atom)