Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Hide single parameter through UI builder class

Posted on by 303

Hi ,

I have requirement to add two new elements in Ledger currency parameter ,"Transaction currency" and "All Currency" , so I have tried to extend the ledgerCurrencySelection Enum and added them. But it is also reflecting in standard Vendor Aging Report also.

So I created a new Enum field for Ledger currency , and I want to use my parameter in my custom vendor aging report and want to hide the standard one. Same way I want to hide my custom field in Vendor aging standard report .

pastedimage1671439649153v1.png

Is there a way to use a parameter or hide it through UI builder class ? Want to use a new parameter or standard one without affecting the standard report parameters.

Please help.

Thanks

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    If it doesn't have UI builder class, then it not possible to achieve this.

    It's better to duplicate the contract class - DP class instead of writing COC for the same.

    Thanks,

    Girish S.

  • PriyaDutta Profile Picture
    PriyaDutta 303 on at
    RE: Hide single parameter through UI builder class

    Hi Girish,

    I do not want to show same report for standard.

    I have created (duplicated standard) new report , new menu item , just extended DP and contract class to add my new parameter,which I want only in my custom report.

    But I do not know why it is reflecting on standard report also.

    And I cannot find any UI builder class for VendAgingReport in AOT , that is why I created a new one.

    thanks,

    Priya

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    As I said earlier it's not easy to show same report at different places since you have added the custom parameters to it.

    Anyways we can give it a try.

    From your code you have created new UI builder class - But there is a standard UI builder class available - Just write COC for build method of the class and check. Refer to my code from my previous reply. I have created a COC for standard UI builder class which includes code for enabling the Enum parameter based on caller menu item.

    Thanks,

    Girish S.

  • PriyaDutta Profile Picture
    PriyaDutta 303 on at
    RE: Hide single parameter through UI builder class

    Hi Girish,

    It is a totally new custom report.

    Yes, even in standard report , both the parameters are visible.

    pastedimage1671529473071v1.png

    This is screenshot of standard report.

    thanks,

    Priya

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    It's not possible to make both reports work if you are using COC or event handler. Since you have added new parameters.

    If you want to have both reports, then you need to duplicate all the standard report objects and customize it as you want.

    So, the standard report will work as it is and your custom report will work separately without interfering standard report.

    Thanks,

    Girish S.

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    You have a separate SSRS report for custom one, right?

    Does the standard report is showing your custom Enum?

    Thanks,

    Girish S.

  • PriyaDutta Profile Picture
    PriyaDutta 303 on at
    RE: Hide single parameter through UI builder class

    Hi Girish,

    I am still getting both the parameters in my report.

    Please see the below code.

    class NAVVendAgingReportUIBuilder extends SrsReportDataContractUIBuilder
    {
        VendAgingReportContract VendAgingReportContract;
        public void build()
        {
    
            //CustAgingReportContract contractclass;
            DialogField dialogEnumCustonm,dialogEnumstandard;
            VendAgingReportContract = this.dataContractObject() as VendAgingReportContract;
            dialogEnumstandard = this.addDialogField(methodStr(VendAgingReportContract,parmCurrencySelection),VendAgingReportContract);
            dialogEnumCustonm = this.addDialogField(methodStr(VendAgingReportContract,parmCurrencySelectionNew),VendAgingReportContract);
            if(this.controller().parmArgs().menuItemName() == menuItemOutputStr(NAVVendAgingBalance))
            {
                dialogEnumCustonm.visible(true);
               dialogEnumstandard.visible(false);
            }
            else  if(this.controller().parmArgs().menuItemName() == menuItemOutputStr(VendAgingBalance))
            {
                dialogEnumCustonm.visible(false);
                dialogEnumstandard.visible(true);
            }
            super();
    
        }
    
    }

    I have also added the new UIBuilder class link to contract extension but it is still not getting triggered.

    [ExtensionOf(classStr(VendAgingReportContract))]
    [
        DataContractAttribute,
        SysOperationContractProcessingAttribute(classStr(NAVVendAgingReportUIBuilder), SysOperationDataContractProcessingMode::CreateUIBuilderForRootContractOnly)
    ]
    
    internal final class NAVVendAgingContract_Extension
    {
        public NAVLedgerCurrencySelection navledgerCurrencySelection;
    
        /// 
        /// Gets or Sets the ledgerCurrencySelection parameter.
        /// 
        /// 
        /// The value to set.
        /// 
        /// 
        /// The value of the ledgerCurrencySelection parameter.
        /// 
        [
            DataMemberAttribute('CurrencySelectionCustom'),
            SysOperationLabelAttribute(literalstr("New")),
            SysOperationHelpTextAttribute(literalstr("@AccountsReceivable:CurrencySelectionText")),
            SysOperationDisplayOrderAttribute('5')
        ]
        public NAVLedgerCurrencySelection parmCurrencySelectionNew(NAVLedgerCurrencySelection _navledgerCurrencySelection = NAVledgerCurrencySelection)
        {
            navledgerCurrencySelection = _navledgerCurrencySelection;
            return navledgerCurrencySelection;
        }
    
    }

    pastedimage1671527619737v1.png

    Not sure what is going wrong.

    Please help.

    Thanks,

    Priya

  • GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    I don't think this will not be the issue unless there wont be any error while deploying or while running report.

    Also, if you duplicate the ssrs report - No need to hide the report parameter - Code which I have sent earlier.

    Standard report will not have the new enum parameter - Only your custom report will have custom enum parameter.

    Thanks,

    Girish S.

  • PriyaDutta Profile Picture
    PriyaDutta 303 on at
    RE: Hide single parameter through UI builder class

    Hi Girish,

    On adding new parameter and then restoring the dataset, why can I see only one parameter on dataset level and 2 on parameter level ?

    pastedimage1671458902116v1.png

    Is this an issue ?

    Thanks.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,832 Super User 2024 Season 1 on at
    RE: Hide single parameter through UI builder class

    I got your point now. Just write COC for UI builder class for method build. Try the below code.

    [ExtensionOf(classStr(CustAgingReportUIBuilder))]
    public final class CustAgingReportUIBuilder_Extension
    {
        public void build()
        {
            CustAgingReportContract contractclass;
            DialogField dialogEnum;
            contractclass = this.dataContractObject() as CustAgingReportContract;
            dialogEnum = this.addDialogField(methodStr(CustAgingReportContract,YourCustomEnumParameter),contractclass);
            if(this.controller().parmArgs().menuItemName() == menuItemOutputStr(YourCustomMenuItemOutput))
            {
                dialogEnum.visible(true);
            }
            else
            {
                dialogEnum.visible(true);
            }
            next build();
        }
    
    }

    Thanks,

    Girish S.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans