Saturday 22 April 2017

Display or edit methods in Dynamics 365 or AX7

New Display or Edit method need to write in extension class.

In the below code is the example for display method in CustTable extension.

[ExtensionOf(tablestr(CustTable))]
final class CustTableEventHandlers_Extension
{
    [SysClientCacheDataMethodAttribute(true)]
    display RetailLoyaltyCardNumber primaryLoyaltyNumber()
    {
        RetailLoyaltyCard   retailLoyaltyCard;

        select firstonly CardNumber from retailLoyaltyCard
            where retailLoyaltyCard.Party == this.party
                && retailLoyaltyCard.Primary == NoYes::Yes;

        return retailLoyaltyCard.CardNumber;
    }
}

After writing logic we need to assign this method to the control in Form.

Set control properties "data method" in the below format

ExtensionClassName::MethodName



No comments:

Post a Comment