Skip to main content

Notifications

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

  • cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Change display order of Events on Portal

    Hi Steven,

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

  • Steven O'Neill Profile Picture
    Steven O'Neill 575 on at
    RE: Change display order of Events on Portal

    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

  • Verified answer
    cloflyMao Profile Picture
    cloflyMao 25,202 on at
    RE: Change display order of Events on Portal

    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
    Steven O'Neill 575 on at
    RE: Change display order of Events on Portal

    Thanx Clofly, works a charm.

  • Verified answer
    Clofly Profile Picture
    Clofly 260 on at
    RE: Change display order of Events on Portal

    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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,965 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,836 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans