How to take control of SSRS Report parameters through UI Builder class in D365FO

Purpose:

The purpose of this document is to demonstrate how we can we defualt and not allowing to edit ssrs report parameter  X++ based on a business logic.

Product:

Dynamics 365 for Finance and Operations, Platform Update 9.

Development approach:

Customization through code , we need make value default and it should be non editable and 

Development:

Created 4 parameters in my case, from to dates, banaccount and exchangeratetype, we need to non editable of  exchangeratetype parameter

Please find the method definition as follows.

class testTransUIBuilder extends SysOperationAutomaticUIBuilder
{
    private DialogField dialogBankID, dialogExrateType, dialogfromdate, dialogtodate;
    public void getFromDialog()
    {
        super();
        testTransContract contract = this.dataContractObject();
        contract.parmExchangeRateTypeName(dialogExrateType.value());
        contract.parmBankAccount(dialogBankID.value());
        contract.parmFromDate(dialogfromdate.value());
        contract.parmToDate(dialogtodate.value());
    }
    protected DialogField addDialogField(IdentifierName _methodName, Object _dataContract = this.dataContractObject())
    {
        DialogField ret;
        testTransContract dataContract = this.dataContractObject() as testTransContract;
        
        switch (_methodName)
        {
            case methodStr(testTransContract, parmExchangeRateTypeName):
                dialogExrateType = this.dialog().addFieldValue(extendedTypeStr(ExchangeRateTypeName), dataContract.parmExchangeRateTypeName(), "Currency Exchange Rate Type");
                dialogExrateType.allowEdit(NoYes::No);
                ret = dialogExrateType;
                break;

            case methodStr(testTransContract, parmBankAccount):
                dialogBankID = this.dialog().addFieldValue(extendedTypeStr(CompanyBankAccount), dataContract.parmBankAccount(),"Bank Account");
                ret = dialogBankID;
                break;

            case methodStr(testTransContract, parmFromDate):
                dialogfromdate = this.dialog().addFieldValue(extendedTypeStr(TransDate), dataContract.parmFromDate(), "From Date");
                ret = dialogfromdate;
                break;
            case methodStr(testTransContract, parmToDate):
                dialogtodate = this.dialog().addFieldValue(extendedTypeStr(TransDate), dataContract.parmToDate(),"To Date");
                ret = dialogtodate;
                break;
        }
        return ret;
    }
}

Comments