Hiển thị các bài đăng có nhãn AOS. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn AOS. Hiển thị tất cả bài đăng

Thứ Ba, 30 tháng 8, 2016

How can I get and show the fields that are part of a table relation?

I assume you are trying to see the fields that make up the specified relation.
In order to do this, you use the DictRelation and DictField classes. Create a new DictRelation based on the table, and then use loadTableRelation() to specify the related table. Create new DictFields and use the DictRelation.lineExternTableValue() method to specify the specific fields:
DictRelation dr;
DictField   Field; 
DictField   RelatedField;
int         RelationIndex = 1;

dr = new DictRelation(tableNum(InventDim));
dr.loadTableRelation(tableNum(EcoResColor));
info(strFmt("%1", tableId2name(dr.externTable())));

Field = new DictField(tableNum(InventDim), dr.lineTableValue(RelationIndex));
RelatedField = new DictField(tableNum(EcoResColor), dr.lineExternTableValue(RelationIndex));

info(strFmt("%1 related to %2", Field.name(), RelatedField.name()));

Thứ Ba, 23 tháng 8, 2016

Connect from one one AOS to another AOS via X++ and execute commands

I had a requirement to connect from one Axapta instance to another instance staying in MORPHX IDE. I have done this lot many times using Visual Studio in my past, but never tried with MORPHX IDE.

So, here are the steps:

Step1

Go to AOT > References > Add Reference to Microsoft.Dynamics.BusinessConnectorNet.dll (this file is usually located in Client folder, default path if you choose C it would be C:\Program Files\Microsoft Dynamics AX\50\Client\Bin)


Step 2

This piece of code shows how to connect to a remote AOS (Application), Here I'm just executing a class and retreiving the customer name. The LogonAs method used below is used to connect via the business connector proxy account as shown below. Otherwise the code is pretty straight forward



Troubleshooting/Error

I ran into this error (Screenshot shown below), Later I realised that on the remote AOS where I was connecting to the business proxy information was not set in Administration > Security > System Accounts form.