Friday 20 May 2016

ADXStudio Lookup Filtering - Filter DropDownList in ADXStudio

As we all know that ADXStudio has one of the intresting Out Of Box feature to Convert CRM Lookup into DropDownList on ADXPortal Entity Form, but the major limitation of this feature is, it stop filtering data if you have applied Lookup Filtering on CRM Lookups in CRM.

So if I want to Filter my two lookup fields on ADXStudio Portal Entity Form, It doesn't work if we will convert them into DropDownList using Entity Form Metadata. i tried to figure out so many alternatives ,Also asked on ADXStudio Community Forum, And I found its the Limitation of converting Lookup into DropDownList in ADXStudio. Hope will get the solution in next ADX release

So only solution that i came into my mind is to use DropDownList Filtering using JQuery in Entity Form to achieve the same.

Here what i was doing...

I had two Lookups on my CRM Case Entity Form (State and City) and I converted them into DropDownList using Entity Form Metadata.  And below is the code through which i filtered my City DropDownList based on State DropDownList:

We can write this JQuery in "Custom JavaScript" section of AdxStudio Entity Form in CRM.

<script type="text/javascript">
    $(function ()
    {
        
        var $state = $('#state');
        var $city = $('#city');

        var $cityList = $city.find('option').clone();

        var stateandcity =
        {
            MP: ["Gwalior", "Indore", "Bhopal", "Other"],
            UP: ["Noida", "Agra", "Lukhnow", "Other"],
            Mahrashtra: ["Nagpur", "Pune", "Mumbai", "Other"]
        }

        $state.change(function ()
        {
            var $selectedState = $(this).find('option:selected').text();
            $city.html($cityList.filter(function () {
                return $.inArray($(this).text(), stateandcity[$selectedState]) >= 0;
            }));
        });
    });
</script>

Here is the Output of the above Code:



4 comments:

  1. This code works on if optionset is values ar defined without spaces
    eg if you have M P instead of MP it is not working

    ReplyDelete
  2. Hi Arpit,

    If my stateandcity there is no MP,UP,Mahrashtra but inside values is available then how can i filter "Gwalior", "Indore", "Bhopal", "Other","Noida", "Agra", "Lukhnow", "Other","Nagpur", "Pune","Mumbai", "Other"

    ReplyDelete
  3. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to

    (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time.

    Contact him now and thank me later.

    ReplyDelete
  4. Special thanks to (hackingsetting50@gmail.com) for exposing my cheating husband. Right with me i got a lot of evidences and proofs that shows that my husband is a fuck boy and as well a cheater ranging from his text messages, call logs, whats-app messages, deleted messages and many more, All thanks to

    (hackingsetting50@gmail.com), if not for him i will never know what has been going on for a long time.

    Contact him now and thank me later.

    ReplyDelete

Blogger Widgets