To improve the performance for Display method in form Grid
In the AOT, find the CustGroup form and override the init() method of its
CustGroup data source with the following code
public void init()
{
super();
this.cacheAddMethod(tableMethodStr(CustGroup,displayPaymTermDescription));
}
This blog is for Dynamics AX (AXAPTA) Developers,this will help you for your development issues. This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use.
08 November 2012
11 October 2012
DictTable and Dictfield / find the table field count and field names
static void DictTable(Args _args)
{
dictTable dt;
DictField df;
int numberOfFields;
int fieldId;
int i;
str table;
;
table = 'inventtable';
dt = new dictTable(tablename2id(table));
numberOfFields = dt.fieldCnt();
for (i = 1; i <= (numberOfFields); i++)
{
fieldId = dt.fieldCnt2Id(i);
//info(dt.fieldName(i));
//info(dt.fieldName(fieldId));
df = dt.fieldObject(fieldId); //instead of we can use below line.
//df = new DictField(tablenum(InventTable),fieldId);
info(df.label());
}
}
{
dictTable dt;
DictField df;
int numberOfFields;
int fieldId;
int i;
str table;
;
table = 'inventtable';
dt = new dictTable(tablename2id(table));
numberOfFields = dt.fieldCnt();
for (i = 1; i <= (numberOfFields); i++)
{
fieldId = dt.fieldCnt2Id(i);
//info(dt.fieldName(i));
//info(dt.fieldName(fieldId));
df = dt.fieldObject(fieldId); //instead of we can use below line.
//df = new DictField(tablenum(InventTable),fieldId);
info(df.label());
}
}
08 October 2012
Notification bar on form / Environment notification bar on form
Notification bar on form / Environment notification bar on form
Please click HERE to download the xpo.
Please click HERE to download the xpo.
22 August 2012
Product Number sequence with X++ code
static void ProductNumSeq(Args _args)
{
EcoResProductDisplayProductNumber prodId;
prodId = NumberSeq::newGetNum(EcoResProductParameters::numRefProductNumber()).num();
info(prodId);
}
{
EcoResProductDisplayProductNumber prodId;
prodId = NumberSeq::newGetNum(EcoResProductParameters::numRefProductNumber()).num();
info(prodId);
}
07 August 2012
Product Creation by using X++ and services / Item creation in AX 2012
Click Here for link
Following code to create Product master by using X++
static void ProductCreate(Args _args)
{
EcoResProductService erProdSvc;
EcoResEcoResProduct EcoResProd;
EcoResEcoResProduct_Product_Master ProdMast;
EcoResEcoResProduct_Translation Translation;
EcoResEcoResProduct_Identifier Identifier;
EcoResEcoResProduct_ProductDimGroup ProdDimGroup;
//Initialize the service object
erProdSvc = EcoResProductService::construct();
EcoResProd = new EcoResEcoResProduct();
ProdMast = new EcoResEcoResProduct_Product_Master();
//ProdDimGroup = new EcoResEcoResProduct_ProductDimGroup();
//Newly created and initialize prodMast
ProdMast.parmDisplayProductNumber("IDB-PM002");
ProdMast.parmProductType(EcoResProductType::Item);
ProdMast.parmSearchName("IDB Product Master 1");
//Create a new translation object:
Translation = ProdMast.createTranslation().addNew();
Translation.parmDescription("IDB product Master");
Translation.parmLanguageId("en-us");
Translation.parmName("IDB Product Master 1");
Identifier = ProdMast.createIdentifier().addNew();
Identifier.parmProductNumber("IDB-PM002");
ProdDimGroup = ProdMast.createProductDimGroup().addNew();
ProdDimGroup.parmProduct("IDB-PM001");
ProdDimGroup.parmProductDimensionGroup("Col");
ProdMast.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
EcoResProd.createProduct().add(ProdMast);
erProdSvc.create(EcoResProd);
}
Following code to create Product master by using X++
static void ProductCreate(Args _args)
{
EcoResProductService erProdSvc;
EcoResEcoResProduct EcoResProd;
EcoResEcoResProduct_Product_Master ProdMast;
EcoResEcoResProduct_Translation Translation;
EcoResEcoResProduct_Identifier Identifier;
EcoResEcoResProduct_ProductDimGroup ProdDimGroup;
//Initialize the service object
erProdSvc = EcoResProductService::construct();
EcoResProd = new EcoResEcoResProduct();
ProdMast = new EcoResEcoResProduct_Product_Master();
//ProdDimGroup = new EcoResEcoResProduct_ProductDimGroup();
//Newly created and initialize prodMast
ProdMast.parmDisplayProductNumber("IDB-PM002");
ProdMast.parmProductType(EcoResProductType::Item);
ProdMast.parmSearchName("IDB Product Master 1");
//Create a new translation object:
Translation = ProdMast.createTranslation().addNew();
Translation.parmDescription("IDB product Master");
Translation.parmLanguageId("en-us");
Translation.parmName("IDB Product Master 1");
Identifier = ProdMast.createIdentifier().addNew();
Identifier.parmProductNumber("IDB-PM002");
ProdDimGroup = ProdMast.createProductDimGroup().addNew();
ProdDimGroup.parmProduct("IDB-PM001");
ProdDimGroup.parmProductDimensionGroup("Col");
ProdMast.parmVariantConfigurationTechnology(EcoResVariantConfigurationTechnologyType::PredefinedVariants);
EcoResProd.createProduct().add(ProdMast);
erProdSvc.create(EcoResProd);
}
27 July 2012
Dialog in class
class TestDialogClass
{
DialogField fromDate, toDate;
FromDate fDate;
ToDate tDate;
}
----
protected void dialog()
{
Dialog dialog;
DialogField field;
;
dialog = new Dialog("My Dialog");
field = dialog.addField(extendedTypeStr(VendAccount)); // add EmplId field
dialog.run(); // show
if (dialog.closedOK())
{
info(field.value());
}
}
----
public static void main(Args args)
{
TestDialogClass tClass = new TestDialogClass();
tClass.dialog();
}
{
DialogField fromDate, toDate;
FromDate fDate;
ToDate tDate;
}
----
protected void dialog()
{
Dialog dialog;
DialogField field;
;
dialog = new Dialog("My Dialog");
field = dialog.addField(extendedTypeStr(VendAccount)); // add EmplId field
dialog.run(); // show
if (dialog.closedOK())
{
info(field.value());
}
}
----
public static void main(Args args)
{
TestDialogClass tClass = new TestDialogClass();
tClass.dialog();
}
03 July 2012
Full Text Index in AX 2012 – X++
A full text index contains location information about each significant word in a string field of a table. Some queries can use this information to run more efficiently and complete much sooner. These are queries that search for words that are embedded in the middle of string fields
A table can have a full text index only if the TableGroup property is set to Main or Group on the table.
You can create a maximum of one full text index per table.
static void GmFTIndexQueryJob6(Args _args)
{
FtiTable recFtiTable; // Specified in the prerequisite topic.
Query query2;
QueryBuildDataSource queryBDSource3;
QueryBuildRange queryBRange4;
QueryRun queryRun5;
print "Start the job.";
// Ensure the proper test data is in the table.
delete_from recFtiTable;
recFtiTable.Field1 = "Shine on you crazy diamond.";
recFtiTable.Field2 = "Record 1.";
recFtiTable.insert();
recFtiTable.Field1 = "And if there is no room upon the hill.";
recFtiTable.Field2 = "Record 2.";
recFtiTable.insert();
// Construct and run a query that uses
// the QueryRangeType::FullText enum value.
query2 = new Query();
queryBDSource3 = query2.addDataSource(tableNum(FtiTable));
queryBRange4 = queryBDSource3.addRange(fieldNum(FtiTable, Field1));
queryBRange4.rangeType(QueryRangeType::FullText);
// The space character is treated as a Boolean OR.
queryBRange4.value("diamond unfounded");
// Loop through the records that are returned by the query.
queryRun5 = new QueryRun(query2);
while (queryRun5.next())
{
recFtiTable = queryRun5.get(tableNum(FtiTable));
print "--------";
print "Field1 == " + recFtiTable.Field1;
print "Field2 == " + recFtiTable.Field2;
}
print "End the job.";
pause;
}
A table can have a full text index only if the TableGroup property is set to Main or Group on the table.
You can create a maximum of one full text index per table.
static void GmFTIndexQueryJob6(Args _args)
{
FtiTable recFtiTable; // Specified in the prerequisite topic.
Query query2;
QueryBuildDataSource queryBDSource3;
QueryBuildRange queryBRange4;
QueryRun queryRun5;
print "Start the job.";
// Ensure the proper test data is in the table.
delete_from recFtiTable;
recFtiTable.Field1 = "Shine on you crazy diamond.";
recFtiTable.Field2 = "Record 1.";
recFtiTable.insert();
recFtiTable.Field1 = "And if there is no room upon the hill.";
recFtiTable.Field2 = "Record 2.";
recFtiTable.insert();
// Construct and run a query that uses
// the QueryRangeType::FullText enum value.
query2 = new Query();
queryBDSource3 = query2.addDataSource(tableNum(FtiTable));
queryBRange4 = queryBDSource3.addRange(fieldNum(FtiTable, Field1));
queryBRange4.rangeType(QueryRangeType::FullText);
// The space character is treated as a Boolean OR.
queryBRange4.value("diamond unfounded");
// Loop through the records that are returned by the query.
queryRun5 = new QueryRun(query2);
while (queryRun5.next())
{
recFtiTable = queryRun5.get(tableNum(FtiTable));
print "--------";
print "Field1 == " + recFtiTable.Field1;
print "Field2 == " + recFtiTable.Field2;
}
print "End the job.";
pause;
}
Subscribe to:
Posts (Atom)
Service class to get the selected record and deleted matching records and refresh the form data source in D365 F&O
[DataContractAttribute] class ABCUserProfilesBulkDeleteContract { UserId userId; [DataMemberAttribute('UserId')] pu...
-
Please click here to access Custom Workflow step by step process:
-
public InventQty onHandInventory(ItemId itemId, InventSiteId inventSiteId,InventLocationId inventLocation) { InventOnhand inventOnh...
-
1. In classDeclaration extend SrsReportDataProviderPreProcess instead of SrsReportDataProviderBase 2. Temp table properties should b...