Notifications
Announcements
No record found.
Is there any way to add date filter (Same as CRM date filter) to entity list in Customer Portal
the existing filter option will only accept fixed value to be added in filter control
*This post is locked for comments
Hi Abdul,
There is no OOB way to add date range filter in Entity List. Check below link:
https://ideas.dynamics.com/ideas/dynamics-crm/ID0002730
The only way is to create custom DateTime/calendar controls and pull the data from CRM using OData/LiquidTemplate and bind it to custom datatable or grid.
Hope it helps.
Cheers
Arpit
I reach to the point of building date control to do the filtration but I'm not able to apply it to the entity listas you knowledge can i do such thing (changing the fetch XML of entity list after it was loaded) or no need to waste time, directly start building custom grid to it
I think it is not possible not tried though. But logically it is not supported. Fetch xml made from the view that you have selected in Entity List and every time when entity list loads its fetch xml creates and pull the data from the CRM using Ajax.
So I would recommend you to go with custom control instead of getting into any unsupported approach which might failed in other browsers also.
Let me know in case of any query.
Also, Please close this thread by marked the answer verified if it helps to solve your problem.
Hi Abdul
you can achieve this using bellow steps
1. You need to make a fetch XML filter on entity list like, select the filter type as per your need.
<filter type="or" adx:uiinputtype="dynamic" adx:uiname="Created On(After)"> <condition value="" attribute="createdon" operator="on-or-after" adx:uiinputtype="dynamic" uiname="DateFilter" /> </filter>
P.S you need to define dynamic type so that portal will not perform any data transformation on filter options.
2. You need to add liquid template for rendering entity filters
{% if page.adx_entitylist %}{% entitylist id:page.adx_entitylist.id %} {% assign filters = entitylist | metafilters: params.mf, entityview %} {% if filters.size > 0 %} <div id="customFilterFormatting"> <h4>Filters</h4> <div id="new-entitylist-filters"> <ul class="list-inline"> {% for filter in filters %} <li class="entitylist-filter-option-group"> {% if filter.selection_mode == 'Single' %} {% assign type = 'radio' %} {% else %} {% assign type = 'checkbox' %} {% endif %} <label class="entitylist-filter-option-group-label h4" data-filter-id="{{ filter.id | h }}">{{ filter.label | h }}</label> <ul class="list-unstyled"> {% for option in filter.options %} <li class="entitylist-filter-option"> {% if option.type == 'text' %} <div class="input-group entitylist-filter-option-text"> <input class="form-control" name="{{ filter.id | h }}" type="text" value="{{ option.text | h }}" /> </div> {% else %} {% if filter.label =='Created On(After)' %} <div class="input-group entitylist-filter-option-text"> <input class="form-control" id="bk_fld_createdon" name="{{ filter.id | h }}" type="text" value="{{ option.text | h }}" style='display:none;' /> <input class='form-control' id='createdonDate' data-target='{{ filter.id | h }}' type='date' value='{{ option.text | h }}' /> </div> {% else %} <div class='entitylist-filter-option'> <label> <input name='{{ filter.id | h }}' type='{{ type | h }}' value='{{ option.id | h }}' />{{ option.label | h }} </label> </div> {% endif %} {% endif %} </li> {% endfor %} </ul> </li> {% endfor %} </ul> <p> <button class='btn btn-default pull-right' data-serialized-query='mf' data-target='#new-entitylist-filters' id='customFilters-ApplyBtn'>Apply Filters</button> </p> </div> </div> {% endif %} {% endentitylist %}
In the sample we have created a date field and text field to store the string value.
3. We need to bind it together with a small script
<script type="text/javascript"> $(document).ready(function () { $("#createdonDate").change(function () { $("#bk_fld_createdon").val($("#createdonDate").val()); }); }); </script>
That should give you the option to select date from the UI and use it for any filter.
P.S this approach will work on only browsers supporting html5.
Hi Lokesh, Thanks a lott :) Above solution using liquid template works great for filtering records in a entity list for specific date.
The simple and best way is to create a custom HTML control and then fetch the data from CRM and Bind it in DataTable. Check this article on this. it might be helpful to you.
crmhub.blogspot.com/.../Jquery-DataTable-in-D365-Portal-Adx-Studio-Portal.html
Hi Lokesh,
when I click 'apply filter'
I can see a /?mf=0%3D is added to the end of my URL (regardless of which date i select)
no entity lists are loading though :(
what am i missing still :? do i need to add additional attributes on the entity list?
thanks
so I managed to get the entity list to show with the below code and some extra tweeks to pass the date parameters... but I was then unable to export the content to excel which was the main objective (apparently)....
so I ended up building my own date range filter on the OOTB entity form
I used two Range filter Sets:
The 1 is the from date and the other the to date
I created an option for each of the months in the year under both filters (24 options in total)
for the From options I set the operator 1 as On-or-after the 1st day of each month (Operator 2 is blank)
for the To options I set the operator 1 as On-or-before the Last Day of each month (Operator 2 is blank)
This will give you 2 years of dates/months/data to filter through (From: jan - dec 2017, To: jan - dec 2018)
its a bit of a manual process and overheads to change these filters each year (going forward), but this should work until MS exposes some sort of date filter on the actual portal (run time) for us to select and filter from...
code if needed....
{% entitylist id:page.adx_entitylist.id %} <div class="navbar navbar-default"> <div class="container-fluid"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#entitylist-navbar-{{ entitylist.id }}"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="{{ page.url }}">{{ entitylist.adx_name }}</a> </div> <div class="collapse navbar-collapse" id="entitylist-navbar-{{ entitylist.id }}"> {% if entitylist.views.size > 1 %} <ul class="nav navbar-nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> <i class="fa fa-list"></i> Views <span class="caret"></span> </a> <ul class="dropdown-menu" role="menu"> {% for view in entitylist.views -%} <li{% if params.view == view.id %} class="active"{% endif %}> <a href="{{ request.path | add_query:'view', view.id }}">{{view.name}}</a> </li> {% endfor -%} </ul> </li> </ul> {% endif %} {% if entitylist.search_enabled %} <form class="navbar-form navbar-left" method="get"> <div class="input-group"> {% if params.search.size > 0 %} <div class="input-group-btn"> <a class="btn btn-default" href="{{ request.path_and_query | remove_query:'search' }}">×</a> </div> {% endif %} <input name="search" class="form-control" value="{{ params.search }}" placeholder="{{ entitylist.search_placeholder | default: 'Search' }}" type="text" /> <div class="input-group-btn"> <button type="submit" class="btn btn-default" title="{{ entitylist.search_tooltip }}"> <i class="fa fa-search"> </i> </button> </div> </div> </form> {% endif %} {% if entitylist.create_enabled %} <ul class="nav navbar-nav navbar-right"> <li> <a href="{{ entitylist.create_url }}"> <i class="fa fa-plus"></i> {{ entitylist.create_label | default: 'Create' }} </a> </li> </ul> {% endif %} </div> </div> </div> {% entityview id:params.view, search:params.search, order:params.order, page:params.page, pagesize:params.pagesize, metafilter:params.mf %} {% assign order = params.order | default: entityview.sort_expression %} <table class="table" data-order="{{ order }}"> <thead> <tr> {% for c in entityview.columns -%} <th width="{{ c.width }}" data-logicalname="{{ c.logical_name }}"> {% if c.sort_enabled %} {% assign current_sort = order | current_sort:c.logical_name %} {% case current_sort %} {% when 'ASC' %} <a href="{{ request.path_and_query | add_query:'order', c.sort_descending }}"> {{ c.name }} <i class="fa fa-sort-asc"></i> </a> {% when 'DESC' %} <a href="{{ request.path_and_query | add_query:'order', c.sort_ascending }}"> {{ c.name }} <i class="fa fa-sort-desc"></i> </a> {% else %} <a href="{{ request.path_and_query | add_query:'order', c.sort_ascending }}"> {{ c.name }} <i class="fa fa-unsorted"></i> </a> {% endcase %} {% else %} {{ c.name }} {% endif %} </th> {% endfor -%} <th width="1"></th> </tr> </thead> <tbody> {% for e in entityview.records -%} <tr> {% for c in entityview.columns -%} {% assign attr = e[c.logical_name] %} {% assign attr_type = c.attribute_type | downcase %} <td data-logicalname="{{ c.logical_name }}"> {% if attr.is_entity_reference -%} {{ attr.name }} {% elsif attr_type == 'datetime' %} {% if attr %} <time datetime="{{ attr | date_to_iso8601 }}"> {{ attr }} </time> {% endif %} {% elsif attr_type == 'picklist' %} {{ attr.label }} {% else %} {{ attr }} {% endif -%} </th> {% endfor -%} <td> {% if entitylist.detail_enabled -%} <a class="btn btn-default btn-xs" href="{{ entitylist.detail_url}}?{{ entitylist.detail_id_parameter }}={{ e.id }}" title="{{ entitylist.detail_label }}"> <i class="fa fa-external-link"></i> </a> {% endif -%} </td> <tr> {% endfor -%} </tbody> </table> {% if entityview.pages.size > 0 %} {% assign first_page = entityview.first_page %} {% assign last_page = entityview.last_page %} {% assign page_offset = entityview.page | minus:1 | divided_by:10 | times:10 %} {% assign page_slice_first_page = page_offset | plus:1 %} {% assign page_slice_last_page = page_offset | plus:10 %} <ul class="pagination"> <li {% unless first_page and entityview.page > 1 %}class="disabled"{% endunless %}> <a {% if first_page and entityview.page > 1 %} href="{{ request.url | add_query:'page', first_page | path_and_query }}" {% endif %}> « </a> </li> <li {% unless entityview.previous_page %}class="disabled"{% endunless %}> <a {% if entityview.previous_page %} href="{{ request.url | add_query:'page', entityview.previous_page | path_and_query }}" {% endif %}> ‹ </a> </li> {% if page_slice_first_page > 1 %} {% assign previous_slice_last_page = page_slice_first_page | minus:1 %} <li> <a href="{{ request.url | add_query:'page', previous_slice_last_page | path_and_query }}"> … </a> </li> {% endif %} {% for page in entityview.pages offset:page_offset limit:10 -%} <li{% if page == entityview.page %} class="active"{% endif %}> <a href="{{ request.url | add_query:'page', page | path_and_query }}"> {{ page }} </a> </li> {% endfor -%} {% if page_slice_last_page < entityview.pages.size %} {% assign next_slice_first_page = page_slice_last_page | plus:1 %} <li> <a href="{{ request.url | add_query:'page', next_slice_first_page | path_and_query }}"> … </a> </li> {% endif %} <li {% unless entityview.next_page %}class="disabled"{% endunless %}> <a {% if entityview.next_page %} href="{{ request.url | add_query:'page', entityview.next_page | path_and_query }}" {% endif %}> › </a> </li> <li {% unless last_page and entityview.page < last_page %}class="disabled"{% endunless %}> <a {% if last_page and entityview.page < last_page %} href="{{ request.url | add_query:'page', last_page | path_and_query }}" {% endif %}> » </a> </li> </ul> {% endif %} {% endentityview %} {% endentitylist %}
I have used the calendar control for my portal but while clicking apply filter am unable to get the records based on date selection.
Please let me know where i am missing.
Thanks,
Jharana
Deleted.
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
SA-08121319-0 4
Calum MacFarlane 4
Alex Fun Wei Jie 2