Enable/Disable a
Financial dimension segment on AX Form:
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:
Override subscribed
method and return isSubscribed variable as shown below:
Override new method and
add the code shown below:
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:
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:
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.
Now, if you open any
customer record from Accounts Receivable -> Common -> Customers, you can
see this in action as shown below:
Enable/Disable a
Financial dimension segment on created form:
No comments:
Post a Comment