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 :
Microsoft Dynamics CRM (Archived)

Dynamics 365 Portal, hide field based on status code using Javascript.

(0) ShareShare
ReportReport
Posted on by

Hello,

I have an entity with different steps. Not sent, sent, approved and so on. When the statuscode is updated to anything else then not sent, I need to hide the send button.
As I understand I must do this with Javascript when building a custom portal. But have trouble to get any satuscode to a variable or hide any field. Used to C# but new to Java. 

Also any good sources of infomration about Javascript and Dynamics 365 Portals are appreciated.

Regards,
Sebbe313

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    oliver.rodrigues Profile Picture
    4,052 on at

    Not entirely clear, but let's see if I got it

    you have entity = entity form ?

    with different steps = status ?

    send button = submit button ?

    Java = JavaScript ?

    it is important to properly identify what components you are working with, so the community can better help you

    try adding the following JS in your Web Page (content, not the root one)

    $(document).ready(function() {

       var status= document.getElementById("your status field").value;

       if (status == "your status value")

         document.getElementsByClassName('action')[0].style.visibility = 'hidden';

    });

  • Suggested answer
    Dmytro Rutkovskyi Profile Picture
    1,835 on at

    I provide just example because its not clear about which part of the Portals you are asking.

    Lets imagine you have entityform for your custom entity. And you have this field (statuscode) as readonly on your form.
    Than you can add custom Javascript to your entityform (or page) which will be like this:

    <script>
    var statuscode = $("#statuscode").val();
    if (statuscode == "1")
    {
    // hide something
    $("#your_custom_filed").closest("td").hide();
    }
    </script>


    If you don't want to see this field on the form, you can mark this as not visible. you still can access its value in Javascript.

    And if you need quite complex logic, probably you need liquid templates.

    There is good start for documentation:
    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/portals/custom-templates-dynamic-content

    https://community.adxstudio.com/products/adxstudio-portals/documentation/developers-guide/

    http://colinvermander.com/tag/dynamics-365-portals/

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans