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)

Show/Hide section based on Related Entity Associated View

(1) ShareShare
ReportReport
Posted on by

I am trying to put in a small section containing the bank information for Lawyers on my account form. I would only like this section to be visible if the "Category" of the account contains the "Lawyer" category. 

We have a separate entity containing all the different types of possible categories. You add a category to the account or contact record by searching for it and adding it. I would like to show/hide this bank information section depending on whether or not the categories associated view contains the category "Lawyer". I know this isn't possible using the supported business logic, but is there a way to access this using javascript?

Thanks,

Jeff

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi Jeff,

    Yes, it's possible. It sounds like your relationship is N:N, if it's not it would be similar but a little different

    1) Add an OnLoad event of your Account entity

    2) Write custom javascript to query CRM using the OData like this msdn.microsoft.com/.../gg309461.aspx

    3) Query for the N:N relationship name as the query, with a filter on accountid (for your current account), and the categoryid (for the Lawyer category).

    4) If you get any results back, the account matches and set the visibility of the section using the methods here: msdn.microsoft.com/.../gg328067.aspx

    Hope this helps! If so I'd appreciate if you would mark this as a helpful answer.

    Thanks,

     Aiden

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Jeff,

    Yes, you are right.

    Out of the box is not possible..

    You can query only using odata in your javascript

    Please use the odata query designer for easier way.

    missdynamicscrm.blogspot.sg/.../tips-and-trick-odata-crm-2011-2013.html

    Or fetch xml also can (using adv find and then download the xml)

    bingsoft.wordpress.com/.../dynamics-xrm-tools-for-crm-2015

    dynamicsxrmtools.codeplex.com

    Hope this helps.

    THanks

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Jeff

    Below is small code for OData Call. You can write your Query and Business Logic in GetCategoryAccount as per your requirement and set visibility of Bank Section.

    Alien has shared the QueryDesigner link you get Designer which will ease you for your query creation.

    Hope this Helps !! If it helped plz mark my answer as verified. Thanks

    function GetCategoryAccount()

    {

    var _odataQuery = "";

       var _Result = ODataCall(oData_query);

    // Continue Business Login.

    }

    function ODataCall(oData_query)

    {

           var _result = null;

           var _serverUrl = Xrm.Page.context.getClientUrl();

           var _oDataSelect = _serverUrl + "/XRMServices/2011/OrganizationData.svc/" + oData_query;

               var _retrieveReq = new XMLHttpRequest();

               _retrieveReq.open("GET", _oDataSelect, false);

               _retrieveReq.setRequestHeader("Accept", "application/json");

               _retrieveReq.setRequestHeader("Content-Type", "application/json;charset=utf-8");

               _retrieveReq.onreadystatechange = function ()

    {

                   if (_retrieveReq.readyState == 4)

    {

                       if (_retrieveReq.status == 200)

    {

                           var _retrieved = JSON.parse(_retrieveReq.responseText).d;

                           if (_retrieved.results.length > 0)

    {

                               _result = _retrieved.results[0];

                           }

                       }

                   }

               };

               _retrieveReq.send();

               return _result;

    }

    Regards,

    Kamran

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