Archive for September, 2013


Consider a scenario, where we need to allow only those financial dimension segments to be edited on the forms which are empty. Suppose, we are defaulting the Financial dimension for Customer from Project record and we have a scenario to only allow those segments to be edited which are not defaulted from Project and are empty. In standard AX, we have the same scenario for Advanced Ledger Entry source document. Here, I am going to explain that how we can achieve the similar functionality for Customer master record in AX. Below are the detailed steps:

Step 1: Create a new class extends from DimensionLinkProvider class

Following are the details of the methods, you need to add:

In classDeclaration, add the variables as shown below:

Image

 

Override subscribed method and return isSubscribed variable as shown below:

Image

 

Override new method and add the code shown below:

Image

As you can see in the above code, we need to check for CustTable record and call our local method to add the logic for enable/disable individual dimension segment on the form. Now we need to create a new method in order to be called from the new method shown above. The new method will be used to call the delegate DimensionLinkAllowFieldEdit . Code is shown below:

Image

Now, override the allowFieldEdit method. This method responds to a Dimension controller object whenever a field is made editable for specific dimension attribute. Below is the definition for the method:

Image

Step 2: Add a reference for CustTableDimensionLinkProvider class in DimensionLinkProviders class

Open the new method of DimensionLinkProviders class and add the code as shown below. Note the letter ‘s’ in class name, this is different from the class from which we extend our new link provider class.

Image

 

Now, if you open any customer record from Accounts Receivable -> Common -> Customers, you can see this in action as shown below:

Image

 

As you can see, the ItemGroup financial dimension segment has some value, so it is not editable and hence the drop down arrow is not showing, whereas the Department segment is editable as it is empty. Interesting, isn’t it. This will work for the segmented entry control as well.

Advertisements

If you need to disable the main account segment in a segmented entry control displayed on the form, then you just need to call a method of LedgerDimensionAccountController class. The code is shown below:

ledgerDimensionController.parmLockMainAccountSegment(true);

You must have the LedgerDimensionAccountController object already initialized, if you have the segmented entry control on the form.

Consider a scenario where we have two customers account with the below Financial dimension values:

 

 

BusinessUnit

CostCenter

Department

Customer1

001

007

024

Customer2

002

011

031

 Now, let say I have a requirement to replace only CostCenter financial dimension for Customer1 with Customer2 if it is not empty. The resulting Financial dimension for Customer1 would become BusinessUnit: 001, CostCenter: 011 and Department: 024.

 Below is the code to implement the above scenario:

Image

I have added the comments on the code for better understanding. 

Enjoy!!