Hi everyone, I wanted to hide the section on quickview form based on lookup field present on main form.
my code is this
function hideAndShow(executionContext)
{
debugger
var formContext = executionContext.getFormContext();
var quickViewControl = formContext.ui.quickForms.get("Quick_Form");
var assetcode = formContext.getAttribute("pcl_field).get value();
if(quickViewControl != undefined)
{
if(quickViewControl.isLoaded())
{
if(assetcode == "Guid1")
{
quickViewControl.ui.tabs.get("tab_1").sections.get("section_1").setVisibile(true);
}
if(assetcode == "Guid2")
{
quickViewControl.ui.tabs.get("tab_1").sections.get("section_2").setVisibile(true);
}
else {
quickViewControl.ui.tabs.get("tab_1").sections.get("section_1").setVisibile(false);
}
Hi,
The code you provided does get the section on the main form.
However, after my testing, this code does not seem to get the section of the quick form.
It is also true that the official file of Microsoft below does not provide a corresponding method.
formContext.ui.quickForms (Client API reference) in model-driven apps - Power Apps | Microsoft Docs
“getControl” in the document can only capture fields.
You can also try hiding the fields directly.
The example I gave controls the hiding of the “Email” field in the “Quick View Form” based on the value of the “Parent Account” field on the Account main form.
The “Email” field is displayed only when the specified account is matched
Please refer to my example to test it:
1. Code.
function hide(executionContext){ var formContext = executionContext.getFormContext(); var parentAccount = formContext.getAttribute("parentaccountid").getValue(); var quickViewControl = formContext.ui.quickForms.get("QuickviewControl1662000232662"); if(quickViewControl){ if(parentAccount){ var account = parentAccount[0].id; if(account == "{A56B3F4B-1BE7-E611-8101-E0071B6AF231}"){ quickViewControl.getControl(1).setVisible(true); // The number in “getControl” is used to select the field, in this form “Email” is the second field from zero. }else{ quickViewControl.getControl(1).setVisible(false); } } } }
2. View results.
Match to the correct account.
Not matched to the correct account.
Hello Kapil, i already tried this but it is not working, i have to use lookup field to hide the sections in quickview.
Hello,
Please follow the below answer link, this should solve your query:
Do let me know if you face any difficulty.
If you find this helpful, please mark it verified.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,522 Super User 2024 Season 2
Martin Dráb 228,441 Most Valuable Professional
nmaenpaa 101,148