Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

(0) ShareShare
ReportReport
Posted on by 768

Hello,

I'm trying to edit SSRS report based on the sysoperation framework. The report is launched from menu item with the particular parmenum parameter. If the report is launched from such menuitem I need to add a new dialog field to my dialogform which also must change the original order of the dialog fields. It should be inserted between 3rd and 4rd fields. Which approach should be followed in that case? I have added a new parm method to my contract class for my new dialog field and marked it as invisible because it should appear only in circumstances described above (I hope it's correct):

 

[
    DataMemberAttribute(),
    SysOperationGroupMemberAttribute('Parameters'),
    SysOperationDisplayOrderAttribute('3'),
    SysOperationLabelAttribute(literalstr("@SYS54971")),
    SysOperationHelpTextAttribute(literalstr("@SYS54971")),
    SysOperationCtrlAllowEditAttribute_ICL(false),
    SysOperationControlVisibilityAttribute(false)
]
public TransDate parmActivationDate(TransDate _activationDate = activationDate)
{
    activationDate = _activationDate;

    return activationDate;
}

Any help would be much appreciated. Thanks.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    Solved. Thank you:)

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    Tried. The same problem. Also when I debug my dialog field dlgActivationDate after the string

    dlgActivationDate           = this.bindInfo().getDialogField(contract, methodStr(ProdCalculation_Contract_ICL, parmActivationDate));

    Contains null value. Why it is so?

    Thanks.

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    It's probably because of SysOperationControlVisibilityAttribute. Remove the attribute and set visible(false) in code when needed.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    Hello Martin,

    Thank you very much for your answers. I have created a new parmMethod for my new field in contract class like that:

    [
        DataMemberAttribute(),
        SysOperationGroupMemberAttribute('Parameters'),
        SysOperationDisplayOrderAttribute('4'),
        SysOperationLabelAttribute(literalstr("@SYS54971")),
        SysOperationHelpTextAttribute(literalstr("@SYS54971")),
        SysOperationCtrlAllowEditAttribute_ICL(false),
        SysOperationControlVisibilityAttribute(false)
    ]
    public TransDate parmActivationDate(TransDate _activationDate = activationDate)
    {
        activationDate = _activationDate;
    
        return activationDate;
    }

    I have pointed it as invisible by default.

    Then I have added the following code to classDeclaration of my the class UIBuilder:

    DialogField                             dlgActivationDate;

    then to postbuild() method of UIBuilder:

    dlgActivationDate           = this.bindInfo().getDialogField(contract, methodStr(ProdCalculation_Contract_ICL, parmActivationDate));
        if(contract.parmIsLaunchedFromBaseData() == IsLaunchedFromBaseData::IsLaunchedFromBaseData)
        {
            dlgActivationDate.visible(true);
            dlgActivationDate.allowEdit(false);
        }

    The system throws error on the string:

    dlgActivationDate.visible(true);

    saying that dialogfield object isn't initialized.

    What's wrong wth the code?

    Thanks.

  • Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    You can use such an enum, if you want, but you need at least two values in the data contract (because you have two cases). You can use boolean, if you're sure that there won't be more cases, or use an enum that you can extend later. Possibly you can use the same enum as for the menu item, but then you need a second value there (for the default case).

    Regarding the UI builder, I would do it in postBuild(). You already set the order of fields by SysOperationDisplayOrderAttribute.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    Hello Martin,

    Thanks for the help. I have created enum with only one value and then I have pointed out the value of that enum in the properties of the menuitem. So it's something like the flag that report has been launched by this particular menitem. Maybe I did it wrong?

    Also which is the best place to handle visibility of the fields in UIBuilder class? Maybe "build" method? How to insert my fields between particular fields?

    Thanks.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,458 Most Valuable Professional on at
    RE: sysoperation framework add dialog field based on the enum parameter of the menuitem which launched the report

    First of all, you need a data member that says which case it is. Populate this value in prePromptModifyContract() method of the controller, based on the enum parameter.

    In the UI builder, look at the new parameter to determine which variant of the UI you should use. Then you can manipulate visibility of ActivationDate.

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans