Search This Blog

Wednesday 25 September 2013

Working with cross company lookups in Microsoft Dynamics AX 2012

There are some tables which have the property save data per company is set to yes.

This means that table save the records as per of the logged in company.You can not see the records of the other company while logging in from the other company.

When we set the property save datapercompany to yes it creates the new column with dataareaid on the table.

Now when we want to see the records of the company while logged in from the other company than we have to use the cross query.

Like there is an example that you have to show the lookup with records other than the loggedin company than you have to use the below query.

As you can see this in the image below.










In the above query I have just use the two key words which allows the records to be cross company and than I have filter the records based on the passed DataAreaId.

As you can see this below.

query.allowCrossCompany(true);
query.addCompanyRange(strFmt(_selectableDataArea));

This was all related to the cross company query.

In the next post i will show you that after selecting the value from the lookup using the cross query how can we insert data into the table without any error.

Thanks

Muhammad Zahid.