web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Hide/disable control on report parameter form/dialog

(2) ShareShare
ReportReport
Posted on by 117
Hello All,
 
I want to hide/disable control on report parameter form/dialog form. I found this article: How to disable/hide report parameter on form  from 2015 that explains how to hide a control. The verified answer was "You can decorate the parm method in the data contract with [SysOperationControlVisibilityAttribute(false)]". I tried that like this:
[
    DataMemberAttribute('Detailed'),
    //SysOperationLabelAttribute(literalstr("@SYS8811")),
    //SysOperationHelpTextAttribute(literalstr("@SYS20687")),
    //SysOperationGroupMemberAttribute('Order'),
    //SysOperationDisplayOrderAttribute('10'),
    //SysOperationGroupMemberAttribute('NoSuchGroupAsOrder'),
    SysOperationControlVisibilityAttribute(false)
]
public boolean parmDetailed(boolean _detailed = detailed)
{
    detailed = _detailed;
    return detailed;
}
It did not hide the control. Instead, the control was displayed as the last control on the form instead of at its usual position. 
 
Another suggestion was to use the SysOperationGroupMemberAttribute method with a group that didn't exist. I tried
[
    DataMemberAttribute('Detailed'),   
    SysOperationGroupMemberAttribute('NoSuchGroupAsOrder')
]
public boolean parmDetailed(boolean _detailed = detailed)
{
    detailed = _detailed;
    return detailed;
}
and it worked. However, that looks like a hack to me.
 
Yet another suggestion in another article showed that you could add code to the build method of the UI Builder class like this:
DialogField detailedField = this.bindInfo().getDialogField(custAgingReportContract, methodStr(custAgingReportContract, parmDetailed));

detailedField.visible(false);
 
I have presented 3 ways to accomplish my goal. Which is the recommended way, and if it is the first one  (SysOperationControlVisibilityAttribute(false) on the parm method), why didn't the verified answer work for me? If the recommended way is not one of these 3, feel free to share.
Categories:
I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,882 Most Valuable Professional on at
    Moved from Integration, Dataverse, and general topics forum to Finance | Project Operations, Human Resources, AX, GP, SL forum, because your question must be about either AX 2012 or D365FO. Please tell us which one.
     
    The reason why the attribute is ignored may be that the visibility is controlled by another logic a UI builder class.
     
    Another idea is opening the SSRS report and switching the Visibility property of the parameter to Hidden.
     
  • CD-28072126-0 Profile Picture
    117 on at
    Thanks for your answer.
     
    The software is Dynamics 365 F & O 10.0.42.
     
    We copied the Customer Aging Report temp table and various classes associated with it. I did not notice anything in the UI Builder class that might have affected it, but I will look again. I see that  DialogField::addDialogField has this code:
     
    // check visibility
     if (!memberInfo.parmVisible())
     {
         return null;
     }
     
    I will see how memberInfo is populated for my parameter.
     
    Now you have introduced a fourth method - open the SSRS report and set its Visibility property to Hidden. It works. I like it the best. It's the simplest method. So, is there a recommended way, or should I just do whatever works?
     
  • Verified answer
    Raj Borad Profile Picture
    1,428 on at
    Hi,
    My recommended approach is to use the UI Builder class method:
     
    DialogField detailedField = this.bindInfo().getDialogField(contract, methodStr(contractClass, parmDetailed));
    detailedField.visible(false);
     
    This gives you full control over visibility and behavior dynamically at runtime. The attribute [SysOperationControlVisibilityAttribute(false)] should work, but it is known to behave inconsistently — especially if the UI Builder class exists or the framework decides control order differently. Using SysOperationGroupMemberAttribute with a fake group name is a hack and not recommended. Go with the UI Builder, as it’s the cleanest, safest, and fully supported way to hide or disable controls.
  • CD-28072126-0 Profile Picture
    117 on at
    I forgot to mention that I don't need the flexibility. For example, I don't need to hide the control at particular times or from particular users. I always need the Detailed version of the report, so I initialise Detailed to Yes and hide it so that it can't be changed. For that reason, I will go with Martin's answer, but if I can accept more than one answer I will accept yours too.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans