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