Monday, October 16, 2023
Thursday, September 3, 2015
How to assign read only access to user in AX 2012
Recently in our project there is a requirement - need to assign the read only access to one of the AX User.
So searching in the AX community for this if any one has implemented similar functionality,finally found the article.
Below is the link.
https://community.dynamics.com/ax/b/kayaconsulting/archive/2013/08/03/ax2012-how-to-create-a-read-only-security-role-walkthrough
Followed the step by step mentioned in the above article and achieved the read only access for the AX user.
Here wanted to add one more point, i.e. in the above article it filters all the *Inquire, *Review for the 'SysModelElement' and SecurityDuty for the 'SysModelElementType'.
In customization, if created new forms/classes/reports and added those new forms/classes/reports in new 'Duties', so in this case these also needs to be included in the 'Role' which created by using the steps mentioned from the above articles. So those objects also will have the 'View' permissions for the AX user.
So searching in the AX community for this if any one has implemented similar functionality,finally found the article.
Below is the link.
https://community.dynamics.com/ax/b/kayaconsulting/archive/2013/08/03/ax2012-how-to-create-a-read-only-security-role-walkthrough
Followed the step by step mentioned in the above article and achieved the read only access for the AX user.
Here wanted to add one more point, i.e. in the above article it filters all the *Inquire, *Review for the 'SysModelElement' and SecurityDuty for the 'SysModelElementType'.
In customization, if created new forms/classes/reports and added those new forms/classes/reports in new 'Duties', so in this case these also needs to be included in the 'Role' which created by using the steps mentioned from the above articles. So those objects also will have the 'View' permissions for the AX user.
Tuesday, August 11, 2015
DAX to the Future: Filtering Data using Dynamic Ranges
DAX to the Future: Filtering Data using Dynamic Ranges: DAX contains some powerful features for filtering data on forms and reports that are easily accessible to end-users, however it’s more power...
Sunday, March 22, 2015
Outbound file generation using File system adapater in AX 2012
Hi All,
Here is example to generate the outbound Xml file using X++ code. This is not the new thing but just posting the info
1. Generating the outbound xml file for selected record or single record - using document service(file system adapter).
2. Generating the outbound xml file for all records( i.e. specified criteria on the query) - using document service(file system adapter).
Example: Generating the outbound xml file for selected record or single record.
Below is the code to generate the outbound xml file for the selected record.
static void GenerateXmlSelectedRecord(Args _args)
{
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
AifEntityKeyList aifEntityKeyList = AifEntityKeyList::construct();
Map keyData;
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
CustTable custTable;
int i,j;
CustCustomerService CustCustomerService = CustCustomerService::construct();
;
custTable = CustTable::find('Cust001');
keyData = SysDictTable::getKeyData(custTable);
aifEntityKey.parmTableId(custTable.TableId);
aifEntityKey.parmRecId(custTable.RecId);
aifEntityKey.parmKeyDataMap(keyData);
aifEntityKeyList.addEntityKey(aifEntityKey);
axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);
axdSendContext.parmSecurity(false);
aifConstraint.parmType(AifConstraintType::NoConstraint) ;
aifConstraintList.addConstraint(aifConstraint) ;
info(strFmt("%1",custTable.AccountNum));
AifSendService::SubmitDefault( classnum(CustCustomerService),
aifEntityKey,
aifConstraintList,
AifSendMode::Async,
axdSendContext.pack());
}
Example: Generating the outbound xml file for all records( i.e. specified criteria on the query).
Below is the code to generate the outbound xml for all the records or specified criteria.
static void GenerateMutiplerecords(Args _args)
{
CustTable custTable;
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
AifEndpointList endpointList;
AifActionId actionId;
Query query;
QueryBuildDataSource qbds;
query = new Query(queryStr(AxdCustomer));
AxdSend::removeChildDs(query);
actionId = AifSendService::getDefaultSendAction(classnum(CustCustomerService), AifSendActionType::SendByQuery);
aifConstraint.parmType(AifConstraintType::NoConstraint);
aifConstraintList.addConstraint(aifConstraint) ;
endpointList = AifSendService::getEligibleEndpoints(actionId, aifConstraintList);
AifSendService::SubmitFromQuery(actionId,endpointList,query,AifSendMode::Async);
}
Here is example to generate the outbound Xml file using X++ code. This is not the new thing but just posting the info
1. Generating the outbound xml file for selected record or single record - using document service(file system adapter).
2. Generating the outbound xml file for all records( i.e. specified criteria on the query) - using document service(file system adapter).
Example: Generating the outbound xml file for selected record or single record.
Below is the code to generate the outbound xml file for the selected record.
static void GenerateXmlSelectedRecord(Args _args)
{
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
AifEntityKeyList aifEntityKeyList = AifEntityKeyList::construct();
Map keyData;
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
CustTable custTable;
int i,j;
CustCustomerService CustCustomerService = CustCustomerService::construct();
;
custTable = CustTable::find('Cust001');
keyData = SysDictTable::getKeyData(custTable);
aifEntityKey.parmTableId(custTable.TableId);
aifEntityKey.parmRecId(custTable.RecId);
aifEntityKey.parmKeyDataMap(keyData);
aifEntityKeyList.addEntityKey(aifEntityKey);
axdSendContext.parmXMLDocPurpose(XMLDocPurpose::Original);
axdSendContext.parmSecurity(false);
aifConstraint.parmType(AifConstraintType::NoConstraint) ;
aifConstraintList.addConstraint(aifConstraint) ;
info(strFmt("%1",custTable.AccountNum));
AifSendService::SubmitDefault( classnum(CustCustomerService),
aifEntityKey,
aifConstraintList,
AifSendMode::Async,
axdSendContext.pack());
}
Example: Generating the outbound xml file for all records( i.e. specified criteria on the query).
Below is the code to generate the outbound xml for all the records or specified criteria.
static void GenerateMutiplerecords(Args _args)
{
CustTable custTable;
AxdSendContext axdSendContext = AxdSendContext::construct();
AifEntityKey aifEntityKey = AifEntityKey::construct();
AifConstraintList aifConstraintList = new AifConstraintList();
AifConstraint aifConstraint = new AifConstraint();
AifEndpointList endpointList;
AifActionId actionId;
Query query;
QueryBuildDataSource qbds;
query = new Query(queryStr(AxdCustomer));
AxdSend::removeChildDs(query);
actionId = AifSendService::getDefaultSendAction(classnum(CustCustomerService), AifSendActionType::SendByQuery);
aifConstraint.parmType(AifConstraintType::NoConstraint);
aifConstraintList.addConstraint(aifConstraint) ;
endpointList = AifSendService::getEligibleEndpoints(actionId, aifConstraintList);
AifSendService::SubmitFromQuery(actionId,endpointList,query,AifSendMode::Async);
}
Wednesday, February 18, 2015
How to find the nth record using the query(qr.addPageRange(postion,postion))
Hi All,
Below is the example of how to find the nth record position using query
static void nthrecordPos(Args _args)
{
Query q;
QueryBuildDataSource qbds;
QueryRun qr;
PurchTable purchTable;
q = new Query();
qbds= q.addDataSource(tableNum(PurchTable));
qbds.addOrderByField(fieldNum(PurchTable, PurchId));
qr = new QueryRun(q);
qr.literals(true);
qr.enablePositionPaging(true);
qr.addPageRange(10,12);
while ( qr.next() )
{
purchTable = qr.get(tablenum(PurchTable));
info(strfmt("%1", purchTable.RecId));
}
}
Let say in the purchTable having 100 records, wanted to find the 10 to12 th record, by using the "qr.addPageRange(10,12)", it fetches on the 10th, 11th and 12th records.
Below is the example of how to find the nth record position using query
static void nthrecordPos(Args _args)
{
Query q;
QueryBuildDataSource qbds;
QueryRun qr;
PurchTable purchTable;
q = new Query();
qbds= q.addDataSource(tableNum(PurchTable));
qbds.addOrderByField(fieldNum(PurchTable, PurchId));
qr = new QueryRun(q);
qr.literals(true);
qr.enablePositionPaging(true);
qr.addPageRange(10,12);
while ( qr.next() )
{
purchTable = qr.get(tablenum(PurchTable));
info(strfmt("%1", purchTable.RecId));
}
}
Let say in the purchTable having 100 records, wanted to find the 10 to12 th record, by using the "qr.addPageRange(10,12)", it fetches on the 10th, 11th and 12th records.
Tuesday, April 9, 2013
Data filteration in dialog box In Microsoft Dynamics AX 2012:
Let say for example, dialog box contains 2 dialog fields i.e. Customer group and Customer account.
Every customer is tagged to one customer group, so now when you enter the customer group in the dialog field of the customer group, the related customer accounts which are tagged to that customer group needs to be shown in the customer account dialog field.
Now to go the setup of the dialog box as shown in the screen shot
Override the control of the customer account dialog field with below code with the control name of the customer account dialog as “Fld2_1” as shown in the above screens hot.
public void Fld2_1_Lookup()
{
SysTableLookup sysTableLookup;
QueryBuildDataSource queryBuildDataSource;
QueryBuildRange queryBuildRange;
Query query;
FormStringControl _control;
;
sysTableLookup = SysTableLookup::newParameters(tablenum(CustTable),dialogCustAccount.control());
sysTableLookup.addLookupfield(fieldnum(CustTable, AccountNum));
sysTableLookup.addLookupfield(fieldnum(CustTable, CustGroup));
query = new Query();
queryBuildDataSource = query.addDataSource(tablenum(CustTable));
queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, custGroup));
queryBuildRange.value(dialogCustGroupId.value());
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}
Now override the “dialogPostRun()” method from the override methods and the code after super() call as shown below.
public void dialogPostRun(DialogRunbase dialog)
{
super(dialog);
dialog.formRun().controlMethodOverload(true);
dialog.formRun().controlMethodOverloadObject(this);
}
Result:
Below is the link for the entire code:
https://skydrive.live.com/?cid=0b5669924378bbb7#cid=0B5669924378BBB7&id=B5669924378BBB7%21232
Thursday, November 15, 2012
How to have different permission for the user in the different companies in AX 2009.
How to have different permission for the user in the
different companies in AX 2009.
For example if we are having 2 companies i.e. ‘CEU’ and ‘CEC’
in AX 2009.So if the user-x will be having the same permissions in both
companies.
Now we want
to have the user to have the different permission in both the companies ‘CEU’
and ‘CEC’.
i.e. let say
the user-x in the company ‘CEU’ to have permission under the module ‘Accounts
Payable’ for sections ‘Journals’ and ‘Inquiries’.
For the
other company ‘CEC’ to have the permission under the module ‘Accounts Payable’
for the section ‘Reports’ only.
So to achieve
this we need to have the following setup to be done. Below is the step by step
procedure to be followed.
Step 1:
Create a new Domain id in the Axapta 2009.
In Module Administration – setup – Domains.
Step 2: Go
to ‘Company accounts’ tab in the same form, over there add the company account ‘CEC’
under the created new Domain ‘Test’ as shown in the below figure
Step 3: Now
go to the user group
In Module
Administration – setup – User group, open the form.
Over here
select the user group for which we wanted to have different permission in 2
companies.
In this let
take the user group ‘PR complete’.
Step 4: Now click on the button ‘Permission, it takes you to ‘User group Permission’ form.
Over here we
can see the domain id against the User group.
Step 5: Now select the ‘Admin’ Domain id and go to
permission tab. Under the permission tab give the permission
Step 6: Now
again come back the tab ‘Overview’, select the ‘Test’ domain id and switch to
the ‘permission’ tab again.
Under the
Accounts Payable – give full control for ‘Reports ‘as shown in the screen shot.
Now, login with
any of the user which is in the user group ‘PR complete’.
So when the
user login
In the
Company ‘CEU’ will be able to see the under Account Payable – ‘Journals’ and
Inquiries’ and in the company ‘CEC’, Accounts Payable – ‘Reports’, ‘Journals’
and Inquiries’.
Since we didn’t
any give any permission for Account Payable – ‘Journals’ and Inquiries’ under
the domain ‘Test’ for ‘Journals’ and ‘Inquiries’ but still able to see in the
company ‘CEC’. The reason is that in the other domain id ‘Admin’ it also
contains the company account ‘CEC’ in it, so it showing up those in it.
So this is
how we can different permission in the different companies by using ‘Domain id’
in the user group.
Sunday, August 19, 2012
AX 2012 : Delete All Transactions
Hi,
Today we will look at, How to delete all transactions from AX 2012. Previously we were using SysDatabaseTransDelete class to do the same but as of now we need to modify that class to work properly with AX 2012 due to DB changes :
We need to modify the SysDatabaseTransDelete.handletable method with the below code :
void handleTable(SysDictTable sysDictTable)
{
TableGroup tableGroup;
if (tableSet.in(sysDictTable.id()))
return;
tableSet.add(sysDictTable.id());
if (sysDictTable && !sysDictTable.isTmp() && !sysDictTable.isMap())
{
tableGroup = sysDictTable.tableGroup();
// Handle company specific tables to be deleted
if (sysDictTable.dataPrCompany())
{
switch(tableGroup)
{
case TableGroup::Transaction:
case TableGroup::WorksheetHeader:
case TableGroup::WorksheetLine:
//FIX - Support new AX2012 transaction table types
case TableGroup::TransactionHeader:
case TableGroup::TransactionLine:
this.handleTransTable(sysDictTable);
break;
default:
this.handleNonTransTable(sysDictTable);
break;
}
}
else
{
// Handle global tables to be deleted
switch(tableGroup)
{
case TableGroup::Transaction:
case TableGroup::WorksheetHeader:
case TableGroup::WorksheetLine:
//FIX - Support new AX2012 transaction table types
case TableGroup::TransactionHeader:
case TableGroup::TransactionLine:
this.handleGlobalTransTable(sysDictTable);
break;
default:
break;
}
}
}
}
Saturday, August 11, 2012
Number Sequence Generation – AX 2012
How to Create/Add
a New Number Sequence in AX 2012.
Step1: Create a new Extended Data Type. As shown in the below screen shot
Step2:
Add the Created EDT in the table.
Create a new table and add the create EDT from
the step1 to the table
Step 3: Add the numRef<name> method in which module this belongs to.
For example,
let say this belongs to Account
Receivable Module, so add it the CustParameters
table.
Following is
the method needs to be added.
Step 4: Need to add the code in the
class “NumberSeqModule<Module Name>
“method “loadModule”.
So in our
case the class is “NumberSeqModuleCustomer”
Ã
load Module ().
Step 5: Create a new form with the data source in the
step 2, as shown in the below.
As shown in
the above screen shot the following methods needs to be included in the form.
Below is the
code that needs to added ..
Forms\ExampleNumSeq\Methods\numberSeqFormHandler()
NumberSeqFormHandler
numberSeqFormHandler()
{
if (!numberSeqFormHandler)
{
numberSeqFormHandler =
NumberSeqFormHandler::newForm(CustParameters::numRefNumSeqId().NumberSequenceId,
element,
ExampleNumSequence_DS,
fieldNum(ExampleNumSequence, NumSeqId)
);
}
return numberSeqFormHandler;
}
Forms\ExampleNumSeq\Data
Sources\ExampleNumSequence\Methods\create()
public void
create(boolean _append = false)
{
element.numberSeqFormHandler().formMethodDataSourceCreatePre();
super(_append);
element.numberSeqFormHandler().formMethodDataSourceCreate();
}
Forms\ExampleNumSeq\Data
Sources\ExampleNumSequence\Methods\write()
public void
write()
{
super();
element.numberSeqFormHandler().formMethodDataSourceWrite();
}
Forms\ExampleNumSeq\Data
Sources\ExampleNumSequence\Methods\validateWrite()
public
boolean validateWrite()
{
boolean ret;
ret = super();
ret = element.numberSeqFormHandler().formMethodDataSourceValidateWrite(ret)
&& ret;
return ret;
}
Forms\ExampleNumSeq\Data
Sources\ExampleNumSequence\Methods\delete
public void
delete()
{
element.numberSeqFormHandler().formMethodDataSourceDelete();
super();
}
Forms\ExampleNumSeq\Data
Sources\ExampleNumSequence\Methods\linkActive
public void
linkActive()
{
element.numberSeqFormHandler().formMethodDataSourceLinkActive();
super();
}
Step 6:
Go to
Account Receivable Ã
setup à Accounts
Receivable parameters, open the form and go to number sequence, over there
check Number Sequence Id is listing or not.
In AX 2009,
after doing with the above 4 steps it list in the parameters of the accounts
receivable.
But in AX
2012 a job needs to run to show in the parameters of the accounts receivable.
Below is the job needs to run…
After
running the job, go to Account Receivable Ã
setup à Accounts
Receivable parameters form, it show the newly created one as below.
Step7: Once In the parameters form, it is
shown need to assign the number sequence code. To assign the number sequence
code need to generate the code for it by wizard or it can be created manually.
Go to Organization Administration Ã
Number Sequence à Number Sequence
A wizard
will be opened, click on next button over there, it show the number sequence
code for the one which create in the above, below is the screen shot
Click next
and Finish button to complete wizard.
Open the
forms which created in the step 5 and create the new record in the form it will
generate the new number sequence, below is the screen shot.
Monday, July 16, 2012
AX build numbers
Overview of AX build numbers
Dynamics AX 2012 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Feature Pack | Kernel build | Application build | Solution build | Comment/Link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Dynamics AX 2012 FP1 (6.1) Hotfix | 6.0.1108.xxx | 6.0.1108.xxx | 6.1.1108.xxx | Published Hotfixes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 FP1 (6.1) RTM | 6.0.947.862 | 6.0.947.280 | 6.0.1108.0 | Feature Pack 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Version | Kernel build | Application build | Comment | Link | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 CU3 | 6.0.1108.670 | 6.0.1108.670 | Cumulative Update 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 CU2 | 6.0.947.280 | 6.0.947.280 | Cumulative Update 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 CU1 | 6.0.947.61 | 6.0.947.61 | Cumulative Update 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 RTM Hotfix [new] | 6.0.1108.xxx | 6.0.1108.xxx | As of Feb 15th | Published Hotfixes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 RTM Hotfix [old] | 6.0.947.xxx | 6.0.947.xxx | Until Feb 15th | Published Hotfixes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2012 RTM | 6.0.947.0 | 6.0.947.0 | RTM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dynamics AX 2009 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Version | Kernel build | Application build | Link | Comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-8 | 5.0.1500.6491 | 5.0.1500.6491 | Rollup 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-7 | 5.0.1500.4570 | 5.0.1500.4570 | Rollup 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-6 | 5.0.1500.3761 | 5.0.1500.3761 | Rollup 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-5 | 5.0.1500.2985 | 5.0.1500.2985 | Rollup 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-4 | 5.0.1500.2116 | 5.0.1500.2116 | Rollup 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-3 | 5.0.1500.1313 | 5.0.1500.1313 | Rollup 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-2 | 5.0.1500.809 | 5.0.1500.809 | Rollup 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 RU-1 | 5.0.1500.358 | 5.0.1500.358 | Rollup 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 Hotfix [New] | 5.0.1600.xxx | 5.0.1600.xxx | Published Hotfixes | As of April 18th | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 Hotfix [Old] | 5.0.1500.xxx | 5.0.1500.xxx | Published Hotfixes | Until April 18th | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 SP1 | 5.0.1000.52 | 5.0.1000.52 | Service Pack 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-6 | 5.0.593.1429 | 5.0.593.1429 | Rollup 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-5 | 5.0.593.1287 | 5.0.593.1287 | Rollup 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-4 | 5.0.593.1084 | 5.0.593.1084 | Rollup 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-3 | 5.0.593.827 | 5.0.593.827 | Rollup 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-2 | 5.0.593.662 | 5.0.593.662 | Rollup 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM RU-1 | 5.0.593.439 | 5.0.593.439 | Rollup 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM Hotfix | 5.0.593.xxx | 5.0.593.xxx | Published Hotfixes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dynamics AX 2009 RTM | 5.0.593.0 | 5.0.593.0 | RTM | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This post does now only list AX 4.0 and previous versions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Dynamics AX 4.0 | |||
| Version | Kernel build | Application build | Comments |
|---|---|---|---|
| Dynamics AX 4.0 RTM | 4.0.1659.26.0 | 4.0.1659.26 | |
| Dynamics AX 4.0 RTM Aug. | 4.0.1659.36.0 | 4.0.1659.36 | Localizations (GLS) |
| Dynamics AX 4.0 SP1 | 4.0.2163.0 | 4.0.2163.0 | |
| Dynamics AX 4.0 SP1 Loc | 4.0.2163.0 | 4.0.2200.0 | With NO/IS/SV GLS layer |
| Dynamics AX 4.0 SP1 Hotfix | 4.0.2500. xxx | 4.0.2500. xxx | Published Hotfixes |
| Dynamics AX 4.0 SP2 | 4.0.2501.116 | 4.0.2501.116 | |
| Dynamics AX 4.0 SP2 | 4.0.2501.116 | 4.0.2501.116/P40-2-30 | With Payroll module |
| Dynamics AX 4.0 SP2 Loc | 4.0.2501.116 | 4.0.2200.0 | NO/IS/SV GLS/GLP |
| Dynamics AX 4.0 SP2 Loc | 4.0.2501.116 | 4.0.2501.121 | EE GLS/GLP |
| Dynamics AX 4.0 SP2 Loc | 4.0.2501.116 | 4.0.2501.347 | EE FeaturePack1 |
| Dynamics AX 4.0 SP2 Hotfix | 4.0.2503. xxx | 4.0.2503. xxx | Published Hotfixes |
Axapta 3.0 | |||
| Version | Kernel build | Application build | Comments |
| Axapta 3.0 | 1951.8 | 514 | OP023 |
| Axapta 3.0 Kernel Hotfix 1 | 1951.801 | 514 | OP023 |
| Axapta 3.0 SP1 first version | 1951.17 | 514-12 SP1 | OP023-6 SP1 |
| Axapta 3.0 SP1 | 1951.18 | 514-12 SP1 | OP023-6 SP1 |
| Axapta 3.0 SP2 | 1951.2410 | 514-90 SP2 | OP023-19 |
| Axapta 3.0 SP3 | 1951.3730 | 514-193 SP3 | OP023-71 |
| Axapta 3.0 SP3 Kernel Hotfix 1 | 1951.3733 | 514-193 SP3 | OP023-71 |
| Axapta 3.0 SP4 | 1951.4060 | 514-320 SP4 | OP023-196 |
| Axapta 3.0 SP5 | 1951.5160 | 514-513 SP5 | OP023-379 |
| Axapta 3.0 SP6 | 1951.7609 | 514-859 SP6 | OP023-659 |
| Axapta 3.0 KR1 | 1951.6710 | ||
| Axapta 3.0 KR2 | 1951.7500 | ||
| Axapta 3.0 KR3 | 1951.7609 | ||
Axapta 2.5 | |||
| Version | Kernel build | Application build | Comments |
| Axapta 2.5 | 1270.3 | 377 | Option Pack 2.5 |
| Axapta 2.5 SP1 | 1270.15 | 377-20 | Option Pack 2.5-1 |
| Axapta 2.5 SP2 | 1270.31 | 377-57 | Market Pack 2.5-2 |
| Axapta 2.5 SP2 Kernel Hotfix 1 | 1270.31-3 | 377-57 | Market Pack 2.5-2 |
| Axapta 2.5 SP3 | 1270.37 | 377-79 | Market Pack 2.5-3 |
| Axapta 2.5 SP3 Kernel Hotfix 1 | 1270.37-1 | 377-79 | Market Pack 2.5-3 |
| Axapta 2.5 SP3 Kernel Hotfix 2 | 1270.3703 | 377-79 | Market Pack 2.5-3 |
| Axapta 2.5 SP4 | 1270.3800 | 377-109 4 | Market Pack 2.5-4 |
Tuesday, July 10, 2012
X++ code to Read/Write Dynamics Ax data to excel
Writing Data to Excel file
How it works
1. Use SysExcelApplication class to create excel file.
2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by
default 3 worksheets will be available).
3. Use SysExcelWorkSheets to select worksheet for writing data.
4. SysExcelCells to select the cells in the excel for writing the data.
5. SysExcelCell to write the data in the selected cells.
6. Once you done with write operation use SysExcelApplication.visible to open
file.
static void Write2ExcelFile(Args _args)
{
InventTable inventTable;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
cell = cells.item(1,1);
cell.value("Item");
cell = cells.item(1,2);
cell.value("Name");
row = 1;
while select inventTable
{
row++;
cell = cells.item(row, 1);
cell.value(inventTable.ItemId);
cell = cells.item(row, 2);
cell.value(inventTable.ItemName);
}
application.visible(true);
}
Reading Data from Excel File
static void ReadExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
ItemId itemid;
Name name;
FileName filename;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "C:\\item.xls";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
itemId = cells.item(row, 1).value().bStr();
name = cells.item(row, 2).value().bStr();
info(strfmt('%1 - %2', itemId, name));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
How it works
1. Use SysExcelApplication class to create excel file.
2. Use SysExcelWorkbooks and SysExcelWorkbook to create a blank workbook(by
default 3 worksheets will be available).
3. Use SysExcelWorkSheets to select worksheet for writing data.
4. SysExcelCells to select the cells in the excel for writing the data.
5. SysExcelCell to write the data in the selected cells.
6. Once you done with write operation use SysExcelApplication.visible to open
file.
static void Write2ExcelFile(Args _args)
{
InventTable inventTable;
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
int row;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
workbook = workbooks.add();
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
cells.range('A:A').numberFormat('@');
cell = cells.item(1,1);
cell.value("Item");
cell = cells.item(1,2);
cell.value("Name");
row = 1;
while select inventTable
{
row++;
cell = cells.item(row, 1);
cell.value(inventTable.ItemId);
cell = cells.item(row, 2);
cell.value(inventTable.ItemName);
}
application.visible(true);
}
Reading Data from Excel File
static void ReadExcel(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
int row;
ItemId itemid;
Name name;
FileName filename;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
//specify the file path that you want to read
filename = "C:\\item.xls";
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
row++;
itemId = cells.item(row, 1).value().bStr();
name = cells.item(row, 2).value().bStr();
info(strfmt('%1 - %2', itemId, name));
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
}
X++ code to hide content pane in ax2009
This is for developers , not for endusers.As you know it will
irritate during developemnt since it is appearing on top of all windows when we
open form.
static void hideContentPaneWindow(Args _args)
{
#WinApi
HWND contentPane = WinApi::findWindowEx(WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', ''),0,'ContentFrame','' );
;
if (contentPane)
WinApi::ShowWindow(contentPane,#SW_HIDE); // To restore use #SW_RESTORE
}
static void hideContentPaneWindow(Args _args)
{
#WinApi
HWND contentPane = WinApi::findWindowEx(WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', ''),0,'ContentFrame','' );
;
if (contentPane)
WinApi::ShowWindow(contentPane,#SW_HIDE); // To restore use #SW_RESTORE
}
How
to import and export data in XML format using AIF framework?
This is the second part of the article about
import and export data in XML format.In the first post we have shown how to import and export data in XML format using Axd classes and it was mostly oriented to X++ developers.
In this post, we
will use data generated in the first post (AxBc and Axd classes) and will
explain how to import and export data in XML format, but using Application
Integration Framework (AIF) features and batch framework. This article is
mostly oriented to end-users.
Setup part:Setup part consists of two parts: AIF setup and Batch framework setup.
AIF setup:
Before starting
AIF setup, please import the xpo file with all required objects from here. Even if you have generated these objects before as a
part of the first article, you still need to import it because some objects
were slightly modified in order to implement Send functionality which will be
used in this article.
The path to the AIF setup forms is: Basic
> Setup > Application Integration FrameworkFigure 0. AIF setup forms location.
1) Open Local
endpoints form and create a new local endpoint for the company where you want
to import data to or to export data from. In our case, it is company DAT.
Figure 1. Local endpoints form
2) Open Transport
adapters form and create a new transport adapter for the file system. Set
Direction field to "Receive or Send" and select Active checkbox.
Figure 2. Transport adapters form
3) Open Channels
form and create two new channels - Outbound and Inbound. The channes simply
specify where the files should be taken from or put in.
At first, create
an outbound channel and then create an inbound one and assign the outbound
channel to it. For the outbound channel, create a folder C:\AIF\Outbound and
for the inbound one - C:\AIF\Inbound.
kFigure 3. 1. A new outbound channel
Figure 3.2. A new inbound channel with the assigned to it outbound one.
4) Open Actions
form and click "Scan and register" button in order to find new
documents and generate new actions for them. In our case, the system will be
looking for AxdMyTable document and will be generating Create, CreateList,
FindEntityKeyList, FindList, Read and ReadList actions for that document. For
all these actions, we need to manually select "Enabled" checkbox.
Figure 4.1. Actions form before new actions were generated.
Figure 4.2. Actions form - searching AOT for new documents
Figure 4.3. Actions form - new actions CreateMyTable and CreateListMyTable for AxdMyTable document.
Figure 4.4.
Actions form - new actions FindEntityKeyListMyTable and FindListMyTable for
AxdMyTable document.
Figure 4.5.
Actions form - new actions ReadMyTable and ReadListMyTable for AxdMyTable
document.
5) Open Endpoints
form and create a new endpoint. The endpoint is used to define rules for import
and export of documents (where to export, who can export, which table fields to
export or to import, etc.).
Figure 5.1. Endpoints form, Overview tab
Figure 5.2. Endpoints form, General tab
Figure 5.3. Endpoints form, Constraints tab
Figure 5.4. Endpoints form, Users tab
6) In the
Endpoints form, click Action policies button. In the Endpoint Action Policies
form, you need to add all 6 actions generated in the Actions form in order to
be able to apply these actions for the AxdMyTable document. For each action,
you need to set the Status field to "Enabled" and Logging Mode to
"Log All".
Figure 6.1. Endpoint Action Policies form - action selection
Figure 6.2. Endpoint Action Policies form - all actions added
7) The last step
of the AIF setup part is to enable fields that can be imported or exported for
each action. For that, select an action and click "Data policies"
button and enable following four fields: DocPurpose, MyFieldInt, MyFieldStr,
Sender as shown on the picture below. Repeat it for each action.
Figure 7. Data policies selection for createListMyTable action.
Batch framework setup:
8) The path to the Batch setup forms is: Basic > Setup > Application Integration Framework.
Figure 8. Batch setup forms location.
9) Open Batch groups form and create a new batch group.
Figure 9. Batch group form with a new batch group 'AIF'.
10) Open Journal
types form and create a new batch journal type. On the General tab, add four
following classes that will be run by batch framework in order to import or
export data: AifGatewayReceiveService, AifInboundProcessingService,
AifOutboundProcessingService, AifGatewaySendService. The sequence in which you
add them is not important at this point.
Figure 10.1. Batch journal type form.
Figure 10.2. AIF RunBaseBatch based classes added to the batch journal type.
11) Open Journal
names form and create a new journal name. Give it a name 'AIF' and in the
Journal type field, select 'AIF' journal type created in the previous step.
Figure 11. Batch journal name form.
12) In the Batch
journal name form, click Jobs button. In the Batch journal line form, click
Ctrl+N and select a class name from the lookup form. Repeat it for each class
name. After all four classes are added, sort them using Up and Down buttons so
that they are listed in the following order:
1.
AifGatewayReceiveService
2.
AifInboundProcessingService
3.
AifOutboundProcessingService
4.
AifGatewaySendService
Figure 12.1. Batch journal line form - class name selection.
Figure 12.2. Batch journal line form - classes are in the correct positions.
That's it with the setup part.
Let's go to execution phase.
Execution part:
1) Import from XML file.
1.1) Copy the
createListMyTable.xml file to the C:\AIF\Inbound folder.
1.2) Go to Basic
> Periodic > Batch and open Batch journal execution form. Specify a
journal name, a batch group and recurrence if necessary, and select the batch
processing checkbox and click OK button.
Figure 1.1. Batch execution forms
Figure 1.2. Batch journal execution form - the journal name selection
Figure 1.3. Batch journal execution form - the batch processing, the batch group and the recurrence selection.
1.3) Open Processing form, select 'AIF' batch group and click OK.
Figure 1.4. Batch processing form
Now the
createListMyTable.xml file should be imported into MyTable table and if you
open the form MyTable form (it is a part of the xpo project imported in the
beginning of AIF setup) you should be able to see two records:
Figure 1.5. Two records imported from the XML file
2) Export into XML file
2.1) Open MyTable
form (select the form in AOT and click Open icon), select the first record and
click Send electronically button. Now the job is added to the gateway queue and
as soon as you run the batch jobs this document will be exported.
2.2) Repeat the steps 1.2 and 1.3 from the
Import part. This will run the batch jobs.
2.3) Now the first
record from the MyTable table should have been exported into XML file and you
should be able to find it in C:\AIF\Outbound folder.
Figure 1.6. The exported 20083624_213604_2113008_00001.xml file.
That's all.
A hint:
If you have a
problem and don't know why data was not imported or exported, look at the Basic
> Periodic > Application Integration Framework > Exceptions form. This
form has a log of all errors occurred during AIF processes and an explanation
why they occurred.
Subscribe to:
Posts (Atom)



























