Monday, 4 July 2016
History of Microsoft Dynamics AX
Microsoft Dynamics AX is one of Microsoft's enterprise resource planning software products. It is part of the Microsoft Dynamics family.
Microsoft Dynamics AX was originally developed as a collaboration between IBM and Danish Damgaard Data as IBM Axapta. Axapta was initially released in March 1998 in the Danish and U.S.
markets. IBM returned all rights in the product to Damgaard Data
shortly after the release of Version 1.5. Damgaard Data merged with
Navision Software A/S in 2000 to form NavisionDamgaard, later named Navision A/S. Microsoft acquired the combined company in July 2002.
The newest version was released in February 2016.
Version |
Release |
Company |
Axapta 1.0
|
March 1998
|
Damgaard A/S
|
Axapta 1.5
|
November 1998
|
Damgaard A/S
|
Axapta 2.0
|
July 1999
|
Damgaard A/S
|
Axapta 2.1
|
January 2000
|
Damgaard A/S
|
Axapta 2.5
|
December 2000
|
Navision-Damgaard
|
Axapta 3.0
|
October 2002
|
Microsoft
|
Microsoft Dynamics AX 4.0
|
March 2006
|
Microsoft
|
Microsoft Dynamics AX 2009
|
June 2008
|
Microsoft
|
Microsoft Dynamics AX 2012
|
August 2011
|
Microsoft
|
Wednesday, 1 June 2016
Role-Based Security to Forms in Microsoft Dynamics AX 2012
Overview
Microsoft Dynamics AX 2012 uses a role-based security framework to assign permissions to users of AX. A user must be assigned to one or more security roles in order to access different functions within AX.Pre-requisites
- Microsoft Dynamics AX 2012
- At least one user must be setup (System administration à Common à Users à Users)
Important Concepts
1. Security roles
Security roles define a particular function that an individual plays in an organization. Security roles are groups of duties and privileges which define the functionality a user can access and parts of the interface a user can view.2. Process cycles
Process cycles are used to organize duties and privileges according to the business processes used in an organization. They are not directly assigned to the user but helps in organizing higher level process of the organization.3. Duties
Duties correspond to individual task that a user can perform, and group related privileges into a single task. Each duty can be assigned to one or more security roles depending upon the business process in question.4. Privileges
Privileges are used to give access to individual application objects like forms and reports. A privilege defines the level of permission that is required to access an application object in AX. Privileges group together permissions that are necessary to complete a specific job.5. Entry point
An entry point corresponds to a starting point that a user is required to access in order to perform a job. Each function in AX is accessed through an entry point. There are 3 different types of entry points in AX:- Menu items
- Web menu items
- Service operations
6. Permissions
Permissions are used to control access to each individual object in Dynamics AX. The level of permission is controlled by the associated Access level. Following are the different Access levels available in AX:- Read
- Update
- Create
- Correct
- Delete
- No Access
Scenario
As part of this tutorial, role-based security will be applied to the Customer groups form (Accounts receivable à Setup à Customers à Customer groups).Steps
- First, to create a new privilege go to AOT à Security à Privileges
- Right click on Privileges and select New Privilege
-
Name it CustomerGroupViewNote: It is a best practice to name a Privilege as MenuItemName + View/Maintain depending upon the Access level
-
Set the Label of the privilege as Customer group view
- Now expand the newly created privilege and create an entry point by right clicking on Entry Points and selecting New Entry Point
- Name the entry point as CustGroup and set the AccessLevel to Read
-
Set the ObjectType to MenuItemDisplay and ObjectName to the menu item of the Customer group form, CustGroup
- Save the privilege
- Now create a duty and assign the above created privilege to the duty
- Go to AOT à Security à Duties
-
Right click on Duties and select New Duty to create a new duty
- Name the duty as CustomerGroupView and set the Label as Customer group view
- Expand the above created duty and create a new privilege by right clicking on the Privileges node and select New Privilege
-
Select the CustomerGroupView privilege in the Name field and save the dutyNote: You can also drag and drop the privilege on the Privileges node
- Next create a new role by going to AOT à Security à Roles
- Right click on Roles node and select New Role
- Name the role as SecurityDemo and Label it as Security demo
- Expand the above created role and right click on Duties node and select New Duty
- Select the CustomerGroupView duty in the Name field and save the role Note: You can also drag and drop the duty on the Duties node
- Now assign the above role to a user Dynamics AX. Go to System administration à Setup à Security à Assign users to roles
- On the Assign users to roles form, select the above created role in the left tree and click on Manually assign / exclude users
- In the opened dialog, select the user to which you want to assign the role and press Assign to role
- A green check mark will appear in case of successful assignment. Close the form
- Now login with the selected role
-
Only the functions assigned to the user will be visible. In this case only the Customer groups form is visible since the Security Role contains only one duty. Also note that only those Menus will be visible that contains the menu item assigned in the Privilege












Monday, 9 May 2016
Code to get the no of records selected in a grid in infolog
void clicked()
{
//this helps us to get the no of records selected in an infolog
FormDataSource fds;
Common common;
int counter;
;
super();
fdS = Table6_DS;//tablename_ds
for (common = fdS.getFirst(true) ? fdS.getFirst(true) : Table6_DS.cursor(); common; common = fdS.getNext())
{
counter++;
}
info(int2str(counter));
}
Thursday, 14 April 2016
Creation of Inquiry Form Using Display Methods
Scenario:
Here the scenario is to show the item details in grid based on selection of item in the form.
The item details include Orderedsum,PhysicalInventory and PhysicalReserved.
But we have to get these three fields through display methods in table.
With the help of above screen shot you can easily understand what my scenario is.
- First of all I have created a table (table6),in that I have taken itemid(edt) as a field, but this table should be temporary table(TempDB).
- Now I have written a method(getorderedsum) in order to get orderedsum field in my form.
Display Qty getorderedsum()
{
Inventsum inventsum;
InventDim inventdim;
;
inventdim.InventSiteId = this.InventSiteId;
inventDim.InventLocationId = this.InventLocationId;
inventDim = InventDim::findOrCreate(inventDim);
select inventsum where
inventsum.itemid == this.ItemId;
return inventsum.orderedSum();
}
- Now I have written another method(getphysicalinventory) to get physical inventory field.
Display Qty getphysicalinventory()
{
InventSum inventsum;
InventDim inventDim;
;
inventdim.InventSiteId = this.InventSiteId;
inventDim.InventLocationId = this.InventLocationId;
inventDim = InventDim::findOrCreate(inventDim);
select inventsum where
inventsum.itemid == this.ItemId
&& inventsum.InventDimId == inventDim.inventDimId;
return inventsum.availPhysicalCalculated();
}
- Now I have written another method(getphysicalreserved) to get physical reserved field.
display qty getphysicalreserved()
{
Inventsum inventsum;
InventDim inventdim;
;
inventdim.InventSiteId = this.InventSiteId;
inventDim.InventLocationId = this.InventLocationId;
inventDim = InventDim::findOrCreate(inventDim);
select inventsum where
inventsum.ItemId == this.ItemId
&& inventsum.InventDimId == inventDim.inventDimId;
return InventSum.availReservation();
}
- Now create a form using the above created table as data source.
- Now override the init method with this code.
public void init()
{
super();
delete_from Table6;
}
- Now in grid create three real edits and name those as Orderedsum,PhysicalInventory and PhysicalReserved respectively.
- Now in realedit properties give the datasource as table6(tablename) and data method as respective method name.
- now do the same for the next two real edits.
- Inorder to get the grid empty set the datasource property insertifempty to NO.
- Then the final output will be as shown below.
Wednesday, 3 February 2016
Select Statements
CrossCompany
static void CON_SelectStatement(Args _args)
{
CustTable custTable;
container companies = ['USMF','IBM'];
while select
crossCompany:companies * from custTable
{
info(custTable.AccountNum);
}
}
firstFast
static void CON_SelectfirstFast(Args _args)
{
CustTable custTable;
while select
firstFast custTable
info(custTable.AccountNum);
}
firstOnly
static void CON_SelectfirstOnly(Args _args)
{
CustTable custTable;
while select
firstOnly custTable
{
info(strFmt("%1--%2",custTable.AccountNum,custTable.dataAreaId));
}
}
forUpdate
static void CON_SelectforUpdate(Args _args)
{
Con_Calc con_Calc;
ttsBegin;
while select
forUpdate con_Calc where con_Calc.Name=="Satya"
{
con_Calc.Name="Satya CH";
con_Calc.update();
info(con_Calc.Name);
}
ttsCommit;
}
static void CON_Selectwhere(Args _args)
{
CustTable custTable;
while select * from
custTable where custTable.CustGroup=="10"
{
info(strFmt("%1--%2",custTable.CustGroup,custTable.AccountNum));
}
}
Groupby
static void CON_SelectGroupby(Args _args)
{
CustTable custTable;
CustTrans custTrans;
while select
minof(AmountMST) from custTrans group by AccountNum
{
info(strFmt("%1--%2",custTrans.AccountNum,custTrans.AmountMST));
}
}
count
static void CON_Selectcount(Args _args)
{
CustTable custTable;
CustTrans custTrans;
int a=0;
while select
count(RecId) from custTable
{
a =
custTable.RecId;
}
info(strFmt("%1",a));
}
change
Company
static void CON_SelectchangeCompany(Args _args)
{
CustTable custTable;
info(custTable.dataAreaId);
changeCompany('IBM')
{
custTable =
null;
while select
custTable
{
info(strFmt('%1',custTable.dataAreaId));
}
}
}
Relational
Operator
static void CON_Select(Args _args)
{
CustTable custTable;
CustTrans custTrans;
int a=0;
while select
custTable where custTable.AccountNum=="DE_005" &&
custTable.AccountNum=="DE_006"
{
info(strFmt("%1",custTable.AccountNum));
}
}
static void CON_Select(Args _args)
{
CustTable custTable;
CustTrans custTrans;
int a=0;
while select
custTable where custTable.AccountNum =="DE_005" ||
custTable.CustGroup =="10"
{
info(strFmt("%1--%2",custTable.AccountNum,custTable.CustGroup));
}
}
Joins
static void CON_SelectJoin(Args _args)
{
CON_Car car;
CON_RentCar rent;
// Inner Join
/* while select car join rent where car.CarID ==
rent.CarID
{
info(strFmt("%1--%2",
car.CarID,rent.CarID));
}
*/
//Outer Join
/* while select car outer join rent where
car.CarID == rent.CarID
{
info(strFmt("%1--%2", car.CarID,rent.CarID));
}
*/
//Exists
/* while select car
exists join rent where car.CarID == rent.CarID
{
info(strFmt("%1--%2", car.CarID,rent.CarID));
}
*/
//Not Exists
while select car
notExists join rent where car.CarID == rent.CarID
{
info(strFmt("%1--%2",
car.CarID,rent.CarID));
}
Dynamic Queries
To Select All Customers from Custtable
static void CON_DynamicQuery(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbd;
CustTable custTable;
q = new Query();
qbd =
q.addDataSource(tableNum(custTable));
qbd.addSortField(fieldNum(CustTable,AccountNum),SortOrder::Ascending);
qr = new
QueryRun(q);
while(qr.next())
{
custTable =
qr.get(tableNum(custTable));
info(strFmt("%1",custTable.AccountNum));
}
}
To Select Customers
Between Range
static void CON_DynamicQuery(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
CustTable custTable;
q = new Query();
qbds = q.addDataSource(tableNum(custTable));
qbds.addSortField(fieldNum(custTable,AccountNum),SortOrder::Descending); // order by
qbr =
qbds.addRange(fieldNum(custTable,AccountNum)); // For all customers
qbr.value(queryRange('US-001','US-009')); // for particular range
qr = new
QueryRun(q);
while(qr.next())
{
custTable =
qr.get(tableNum(custTable));
info(custTable.AccountNum);
}
}
static void Job34(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
CustTable custTable;
q = new Query();
qbds =
q.addDataSource(tableNum(custTable));
//qbds.addSortField(fieldNum(custTable,AccountNum),SortOrder::Descending);
qbds.addSortField(fieldNum(custTable,CustGroup),SortOrder::Descending);
qbr =
qbds.addRange(fieldnum(custTable,CustGroup));
qbr.value(queryRange('10','30'));
qr = new QueryRun(q);
while(qr.next())
{
custTable = qr.get(tableNum(custTable));
info(strFmt("%1--%2",custTable.CustGroup,custTable.AccountNum));
}
}
CrossCompany
static void CON_DynamicStatement(Args _args)
{
CustTable custTable;
Query query;
QueryBuildDataSource qbds;
QueryRun qr;
query = new Query();
query.allowCrossCompany(true);
//
query.addCompanyRange('USMF');
//
query.addCompanyRange('IBM');
qbds = query.addDataSource(tableNum(custTable));
qr = new QueryRun(query);
while(qr.next())
{
custTable
= qr.get(tableNum(custTable));
info(strFmt('%1-%2',custTable.AccountNum,custTable.dataAreaId));
}
}
Aggregate
Function -- min,max,sum,count,computedcolumn,database
static void CON_Dynamic(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
VendTable vendTable;
CustTable custTable;
CustTrans custTrans;
q = new Query();
qbds =
q.addDataSource(tableNum(custTrans));
qbds.addSelectionField(fieldNum(custTrans,AmountMST),Selectionfield::Min);
qbds.addSelectionField(fieldNum(custTrans,RecId),SelectionField::Count);
qr = new QueryRun(q);
while(qr.next())
{
custTrans =
qr.get(tableNum(custTrans));
info(strFmt("%1",custTrans.AmountMST));
}
}
First
only,first fast
static void CON_Dynamic(Args _args)
{
int i;
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
VendTable vendTable;
CustTable custTable;
CustTrans custTrans;
q = new Query();
qbds=
q.addDataSource(tableNum(custTable));
qbds.addSortField(fieldNum(custTable,AccountNum),SortOrder::Descending);
qbds.firstOnly(true); //firstonly
--firstfast
qr = new
QueryRun(q);
while(qr.next())
{
custTable =
qr.get(tableNum(custTable));
info(strFmt("%1",custTable.AccountNum));
}
}
forUPdate
static void CON_DynamicforUpdate(Args _args)
{
int i;
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
VendTable vendTable;
CustTable custTable;
CustTrans custTrans;
Con_Calc obj;
q = new Query();
qbds=
q.addDataSource(tableNum(Con_Calc));
//qbds.addSortField(fieldNum(custTable,AccountNum),SortOrder::Descending);
//qbds.firstFast(true);
qbds.addSortField(fieldNum(Con_Calc,Name));
qr = new
QueryRun(q);
while(qr.next())
{
obj =
qr.get(tableNum(Con_Calc));
obj.selectForUpdate(true);
ttsBegin;
if(obj.Name
=="Siva")
{
obj.Name="Sivakumar";
obj.update();
}
ttsCommit;
info(strFmt("%1",obj.Name));
}
}
GroupBy
static void CON_DynamicGroupBy(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
CustTable custTable;
CustTrans custTrans;
q = new Query();
qbds =
q.addDataSource(tableNum(custTrans));
//qbds.addSortField(fieldNum(custTable,AccountNum));
qbds.addSelectionField(fieldNum(custTrans,
AmountMST),SelectionField::Max); //Aggregate
qbds.addGroupByField(fieldNum(custTrans,AccountNum),OrderMode::GroupBy);
//group by
qr = new
QueryRun(q);
while(qr.next())
{
custTrans =
qr.get(tableNum(custTrans));
info(strFmt("%1--%2",custTrans.AccountNum,custTrans.AmountMST));
}
}
Joins
static void CON_DynamicJoin(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbdsCustTable,qbdsCustTrans;
QueryBuildRange qbr;
CustTable custTable;
CustTrans custTrans;
CON_Car car;
CON_RentCar rent;
q = new Query();
qbdsCustTable =
q.addDataSource(tableNum(CON_Car)); //Data Source 1
//qbdsCustTable.addSortField(fieldNum(CON_Car,CarId),SortOrder::Descending);
qbdsCustTrans =
qbdsCustTable.addDataSource(tableNum(CON_RentCar)); //Data Source 2
qbdsCustTrans.relations(false);
qbdsCustTrans.joinMode(JoinMode::InnerJoin); //Join Type
qbdsCustTrans.addLink(fieldNum(CON_Car,CarId),fieldNum(CON_RentCar,CarId));
qr = new
QueryRun(q);
while(qr.next())
{
car =
qr.get(tableNum(CON_Car));
rent =
qr.get(tableNum(CON_RentCar));
info(strFmt("%1--%2",car.CarId,rent.CarId));
}
}
Full
Text Index
static void CON_FullTextIndex(Args _args)
{
Query q;
QueryRun qr;
QueryBuildDataSource qbds;
QueryBuildRange qbr;
Con_Calc obj;
q = new Query();
qbds = q.addDataSource(tableNum(Con_Calc));
qbr = qbds.addRange(fieldNum(Con_Calc,Name));
qbr.rangeType(QueryRangeType::FullText);
qbr.value("Raj kumar");
qr = new QueryRun(q);
while(qr.next())
{
obj =
qr.get(tableNum(Con_Calc));
info(obj.Name);
}
}
Multiple
Tables Join
static void CON_DyamicQUeries(Args _args)
{
Query query = new Query();
QueryBuildDataSource
salesTableDS;
QueryBuildDataSource
salesLineDS;
QueryBuildDataSource
custTableDS;
QueryRun qr;
CustTable custTable;
SalesTable salesTable;
SalesLine salesLine;
salesTableDS =
query.addDataSource(tableNum(SalesTable));
salesLineDS =
salesTableDS.addDataSource(tableNum(SalesLine));
salesLineDS.relations(true);
//salesLineDS.fetchMode(QueryFetchMode::One2One);
salesLineDS.joinMode(JoinMode::InnerJoin);
salesLineDS.addLink(fieldNum(SalesTable, SalesId), fieldNum(SalesLine,
SalesId));
custTableDS =
salesTableDS.addDataSource(tableNum(CustTable));
custTableDS.relations(false);
custTableDS.addLink(fieldNum(SalesTable, CustAccount),
fieldNum(CustTable, AccountNum));
//custTableDS.fetchMode(QueryFetchMode::One2One);
custTableDS.joinMode(JoinMode::InnerJoin);
//info(salesTableDS.toString());.
qr = new
QueryRun(query);
while(qr.next())
{
salesTable=
qr.get(tableNum(salesTable));
salesLine =
qr.get(tableNum(salesLine));
CustTable =
qr.get(tableNum(custTable));
info(strFmt("%1---%2---%3",salesTable.SalesId,salesLine.SalesId,custTable.AccountNum));
}
}
Functions in Ax 2012
static void
CON_functions(Args _args)
{
int i;
real r;
str s;
container con;
date d;
// AifDocumentCreateAttribute
//i = 1<<4;
//i = 1>>4;
//i = (100>101)?1:5;
//i = abs(10*20.69544);
abs Retrieves the absolute value of a real number.
// i = acos(180);
acos Retrieves the arc cosine of a real number.
// i = 42373;
//mydate = any2date(i); any2date
//s = 1;
//st = any2enum(s);
any2enum
// x = any2int(s);
any2int
// x = any2int64(s);
any2int64
// x = any2real(s);
any2real
// x = any2str(s); any2str
// i = asin(1.2);
asin
// i = atan(1/0);
atan
// x = attributeStr(AifDocumentCreateAttribute); attributeStr
// beep(); beep
// x = char2num("RaJendra",1); char2num
// x = classIdGet(obj);
classIdGet
// x = classStr(Global); classStr
//Container
//con =
["Rajendra","chilukuri","410",9440078438];
//info(strfmt("%1",conPeek(con,5))); conPeek
//con = conPoke(con,2,"Chilukuri's");
//info(strfmt("%1",conPeek(con,2))); conPoke
//s = conLen(con);
//info(strfmt("%1",s)); conLen
//con = conIns(con,5,"Hello How are You ??????");
//info(strFmt("%1",conPeek(con,5))); conIns
//info(strFmt("%1",conFind(con,"410"))); conFind
//con = conNull();
//info(strFmt("%1",conPeek(con,1))); conNull
//con = conDel(con,1,1);
//info(strFmt("%1" ,conPeek(con,1))); // conDel
//i = corrflagset(0.369,2);
//i = cos(900);
cos Retrieves the cosine
of a real number.
//i = cosh(0);
cosh Argument values outside
of the range –250 to 250 result in the following run-time error: "Argument
for trigonometric function out of range."
//i = cTerm(10,100,50);
cTerm Calculates the number
of periods required for the current investment value to yield a target value.
//x = curext();
curext Retrieves the
extension that is used for the current company.
//x = curUserId();
curUserId Retrieves the
nonnumeric ID that represents the current user.
//x = datasetStr(CustomerList); datasetStr Retrieves the name of a dataset as a
string.
//d = today();
// s = date2num(d);
date2num Converts a date to an
integer that corresponds to the number of days since 1 January, 1900.
// date2Str Converts the specified date
to a string.
//utcDateTime
utc2 = 1959-06-17T15:44:33;
//x = datetime2str(utc2);
//formStr
Retrieves the name of a form.
// i = frac(1.3658);
Retrieves the decimal part of a real number.
//info(strFmt("%1",funcName())); //Retrieves a
string that contains the current function context. o/p con_functions
//setPrefix("Hai");
//setPrefix("Hello"); Retrieves the current execution prefix
after successive calls to the setPrefix function.
//setPrefix("Namaskaram");
//setPrefix("Whole Ax Team");
//info(getPrefix());
//date refDate = str2Date("4/9/2007", 213);
//date inputDate = str2Date("10/5/2007", 213);
//int numberOfIntervals;
//;
//numberOfIntervals = intvMax(inputDate, refDate,
intvScale::YearMonth);
//info(strFmt("%1",numberOfIntervals));
//i = logn(100);
Retrieves the natural logarithm of the specified real number.
//s = match("<abc","abcdef"); Searches for a string or expression
within another string.
//s = min(12,15,19);
//d = maxDate();
Retrieves the maximum value allowed for a variable of type date.
//i = maxInt();
//x = methodStr(Calculator,exponent); Validates that the specified method exists
in the specified class; if not, a compiler error occurs.
//d = mkDate(11,1,2016); Creates a date based on three integers,
which indicate the day, month, and year, respectively.
//str x1 =mthName(1); Retrieves the name of the specified
month
//s = mthOfYr(today());
//d = prevyr(today());
//x = num2char(67); Converts an integer to the
corresponding ASCII character.
//d = num2date(364); // Retrieves the date that
corresponds to the specified number of days after 01\01\1900.
//s = power(5,2);
//i = round(15,4.00);
//info(strFmt("%1",sessionId()));
//int seconds = 10;
//int i1;
//i = sleep(60);
//d = str2Date("31/02/2010",213);
//s = strAlpha("?a*bc123."); Copies only the alphanumeric characters
from a string.
//i = strCmp("Raj","Raj");
//strColSeq Converts all uppercase
characters to lowercase characters and converts all characters with accents to
the corresponding unaccented lowercase characters.
//info(strFmt("%1",
strDel("abcdef",2,3)));
Creates a copy of a string with the specified substring removed.
//info(strFmt("%1",strKeep("Hellohainamastehi","hai")));
returns str2 values based on str1
//info(strFmt("%1",strRep("Rajendra
",3))); Repeats a string of
characters.
//info(strFmt("%1",timeNow())); The number of seconds that have
elapsed since midnight.
//r = trunc(3.12);
//print strFmt("r = %1", r); Truncates a real number by
removing any decimal places.
//pause;
//info(strFmt("%1",year(today()))); Retrieves the year from a date value.
info(strFmt("%1",yearDiff(today(),today()-7)));
}
Subscribe to:
Posts (Atom)