web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Change display order of Events on Portal

(0) ShareShare
ReportReport
Posted on by 575

Hi all

We've downloaded a local version of the Events Portal and currently working on this before uploading the changes to the hosted Portal. Two areas I'm struggling with are:

  • how to change the default order the Home page displays the Events (by default it displays the Events in alphabetical order but we're looking for this to default to Date order); and
  • how to filter the Events so only those Events still to happen are shown on the Home page

I can see in home.component.ts how the orderEvents function is working but that's only useful when selecting the dropdown option and changing the order manually. Anyone know what settings need changing here for the Events to display in date order without the need to manually use the dropdown field on the Home page?

As for the Event filtering, I know that if we move the Event back to Draft then it will come off the Portal but I would have assumed that only those Events with a date of today onwards should be shown by default. Any ideas how we can filter the list so Events with a past date are not shown on the list?

Thanx for any advice as always.

Steven

I have the same question (0)
  • Verified answer
    Clofly Profile Picture
    260 on at

    Hi Steven,

    Question 1:

    You can copy "date-desc"(or "date-asc") sort function from the orderEvents function to the loadPublishedEvents function, then event records will sort in date descending order.

    pastedimage1614304185829v1.png

    Test

    pastedimage1614304284228v2.png

    Question 2:

    In home.component.html, we bind a custom function to control event display. As the screenshot reveals, we pass event object as parameter to the function.

    pastedimage1614308801303v3.png

    In home.component.ts, build the custom function.

    private compareDate(event: Event): boolean {
        let tzoffset = (new Date()).getTimezoneOffset() * 60000;
        let today = (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1);
        if (event.startDate.toString() > today) {
            return true;
        } else {
            return false;
        }
    }

    Get our local time in iso-string format and do comparison between it and the start date of event.

    (Due to event start date is stored in iso-string format.)

    pastedimage1614309219522v4.png

    Test

    I have 5 events and event "Feb Event" starts at 2/26/2021 11:00 AM.

    pastedimage1614309450168v5.png

    Now time for me is 2/26/2021 11:19 AM, so the "Feb Event" record will be hidden.

    7824.PNG

  • Steven O'Neill Profile Picture
    575 on at

    Thanx Clofly, works a charm.

  • Verified answer
    cloflyMao Profile Picture
    25,210 on at

    Hi Steven,

    Please ignore this reply.

    Clofly 2 Mao is my backup account, there is issue with my main account in recent days, now the issue is fixed, this is just a simple reply from my main account.

  • Steven O'Neill Profile Picture
    575 on at

    Hi Clofly

    Yes your suggestions worked a charm. Only problem I'm having now is using the DeployToDynamics365Instance.ps1 delpoyment script as it appears to connect to the instance, it appears to update everything but the site does not change in anyway (even after many cache clearances and portal restarts).

    I can manually upload the files and what I've changed works but I've made an alteration to the environment.ts file (took the environment.d365.ts file and changed this to simply environment.ts and made my changes there on the local deployment and all works as expected). Doesn't seem to upload the files from my local system to the hosted environment though.

    I've asked about this here: community.dynamics.com/.../push-changes-to-hosted-portal but to date I've not heard any thots.

    Any ideas would be appreciated.

    Steven

  • cloflyMao Profile Picture
    25,210 on at

    Hi Steven,

    Please take a look to my reply in that thread. :)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 129 Super User 2026 Season 1

#2
Jimmy Passeti Profile Picture

Jimmy Passeti 46 Most Valuable Professional

#3
NeerajPawar Profile Picture

NeerajPawar 41

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans