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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Hide form fields on en...
Power Pages
Unanswered

Hide form fields on entity form on portal

(0) ShareShare
ReportReport
Posted on by 22
Hello,

I have an entity with lookup fields to customer and contact. I have the contact lookup filtered based on the customer. However if someone chooses contact first they can select any contact.

Is there a way to disable or hide the contact field till a customer is selected?

The end goal is to make sure the contact is associated with the customer selected at form submit.

I have tried business rules but they don’t seem to work on portals..
Categories:
I have the same question (0)
  • Verified answer
    Sandeep Dhanrajani Profile Picture
    on at

    @aberson - Form fields are available to you in JavaScript to extend or modify the behavior such as show / hide or enable / disable. See documentation  here provided for web forms but should work for entity forms as well.

    Business rules do not work with portal forms.

  • v-xida-msft Profile Picture
    on at

    Hi @aberson ,

    Could you please share a bit more about your scenario?

    Do you want to disable or hide the Contact field till the Customer field value is selected?

     

    Based on the needs that you mentioned, I think the "Business rules" functionality in CDS Entity could achieve your needs. I have made a test on my side, please consider take a try with the following workaround:

    6.JPG

     

    7.JPG

     

     

    8.JPG

    More details about creating a Business Rule for a Entity, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/model-driven-apps/create-business-rules-recommendations-apply-logic-form

     

    Please consider take a try with above solution, check if the issue is solved.

     

    Best regards,

  • aberson Profile Picture
    22 on at
    Thank you for the response. Either hiding or disabling can work.

    I don’t think the business rules work when the CDS form is displayed on a portal.
  • aberson Profile Picture
    22 on at

    I tried the java and am unable to select the entire input. I can hide the input by using .parent() and the label separately.

     

    However, if i start with the field hidden from the form i can't grab it to show it.... I can't seem to find the logical name of the entity form input to take action on it....

  • v-xida-msft Profile Picture
    on at

    Hi @aberson ,

    Have you taken a Custom JavaScript to achieve your needs?

     

    Based on the needs that you mentioned, I also agree with @sandeepd 's thought almost. You could consider add a custom JavaScript to the Entity form to control the form field visible or invisible through Power Portal Management.

     

    I have made a test on my side, please consider take a try with the following workaround:

    1.JPG

    Please consider go to your Portal Management (Model-Driven app), then click "Entity forms" tab, then select the Entity form where you want to achieve your logic.

    Then switch to "Additional Settings" tab, scroll down to the "Custom JavaScript" part, type the above JavaScript code, then save your Entity form.

    $(document).ready(function(){
     var currentValue = $("#crba2_customer").val();
     if(currentValue==null || currentValue == ''){
     $("#crba2_normalcontact").style.display = 'none'
     }else{
     $("#crba2_normalcontact").style.display = 'block'
     }
    })

    After that, re-open your Portal, then check if the issue is solved.

     

    More details about adding a custom JavaScript in Entity forms/Web Forms, please check the following article:

    https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/add-custom-javascript

     

    Best regards, 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Pages

#1
Jerry-IN Profile Picture

Jerry-IN 71

#2
Fubar Profile Picture

Fubar 62 Super User 2025 Season 2

#3
sannavajjala87 Profile Picture

sannavajjala87 31

Last 30 days Overall leaderboard