Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Adding an onclick event to a yes/no on Portal

(0) ShareShare
ReportReport
Posted on by 511

Hi


I want to have a field that appears/disappears if a yes/no is selected or not. - This is something I can do for a D365 form using either JavaScript or a Business Rule.

What is the equivalent functionality for use in the Portal?

Thanks

Lee 

  • CRMJetty Profile Picture
    CRMJetty 3,508 on at
    RE: Adding an onclick event to a yes/no on Portal

    Hi Lee,

    In regards to your concern, refer below link to set field visibility based on other field value change in portal:
    https://www.agarwalritika.com/post/toggle-field-visibility-based-on-another-field-in-power-apps-portals

    I hope it helps,

    Thanks.

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding an onclick event to a yes/no on Portal

    Hi Lee,

    I'm glad your problem has been solved, can you share your solution if possible?

    Regards,

    Leah Ju

  • Lee-Martin Profile Picture
    Lee-Martin 511 on at
    RE: Adding an onclick event to a yes/no on Portal

    Thanks Leah, but the issue isn't adding JavaScript, it's how to had an onclick to the form object.

    Luckily I've been able to find this elsewhere now.

    Thanks for replying everyone

    Lee

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Adding an onclick event to a yes/no on Portal

    Hi Lee,

    Two ways you can add custom javascript to the portal.

    1.Go Portal management app.

     Navigate to entity forms to open one you need, and move to 'Additional Setting' tab, then you can add js code to 'Custom Javascript' section.

    pastedimage1618821730598v1.png

    2.Edit portal by administrator.

    You need login the portal with administrator, you will view pane in the top of the page.

    pastedimage1618821884807v2.png

    you can open the page you need, then click 'Edit' button.

    pastedimage1618821939509v3.png

    One dialog will open, you can add js ode under 'Options' tab.

    pastedimage1618821979078v4.png

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Torrado Profile Picture
    Torrado 1,270 on at
  • Lee-Martin Profile Picture
    Lee-Martin 511 on at
    RE: Adding an onclick event to a yes/no on Portal

    Is there information anywhere as to how/where I would amend to the liquid in order to do this?

  • Torrado Profile Picture
    Torrado 1,270 on at
    RE: Adding an onclick event to a yes/no on Portal

    Yes, if that's your requirement, you can call the function from an onclick event.

    Please mark the answer as verified if helpful.

  • Lee-Martin Profile Picture
    Lee-Martin 511 on at
    RE: Adding an onclick event to a yes/no on Portal

    Thanks

    Do I need to add an onclick event to the form somehow? perhaps using liquid?

  • Suggested answer
    Torrado Profile Picture
    Torrado 1,270 on at
    RE: Adding an onclick event to a yes/no on Portal

    Hello Lee-Martin,

    In your case, you want to have Client-Side logic to modify the visibility of a field, so you need to address that requirement using JavaScript (please check this official article).

    • Example:

    function setFieldVisibility(fieldName, displayStatus) {

      if (displayStatus == "show") {

          $("#" + fieldName).closest("tr").show()

      }

      else if (displayStatus == "hide") {

          $("#" + fieldName).closest("tr").hide()

      }

    }

    • Then you can use the function as following:

    setFieldVisibility("FieldName", "show")

    setFieldVisibility("FieldName", "hide")

    You can of course modify the function to fit your needs.

    Refer also this post: https://community.dynamics.com/365/sales/f/dynamics-365-for-sales-forum/299169/show-or-hide-fields-on-entity-form-on-dynamics-365-portals 

    Hope that this helps you!

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,489 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans