Skip to main content

Notifications

Customer Service forum

How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

Posted on by 2

Hi all,

Hoping you can help.

Background:

  • We have portal contacts which may be associated with an account (re-labelled organisation).
  • When the contact logs into the customer self service portal, they should be able to view their organisation's profile (some can edit)
  • We have a link from the contact's profile to the org profile, implemented as an entity form.
  • If the contact is associated with an org, this works fine
  • If not, we get an ugly, unhelpful, error message back ("An unknown failure has occurred. Error ID # [c9c4983f-61ff-414d-bb39-fa8e78c793cd]")
    7840.error.PNG

It's a legitimate case that the contact may not be associated with an org. How can we display a friendly error message to the user instead?

Note:

  • I have, under the Entity Form, defined a friendly message in the "Record Not Found Message" field
    ent_2D00_form_2D00_friendly_2D00_message_2D00_config.PNG
  • We have enabled portal logging, I get two errors in the logs which both recognise that the account requested does not exist - it doesn't appear like there's something else totally unexpected going on
  • From the doco I've read, I expect that when a record is not found (which error logs seem to indicate), the "Record Not Found Message" value should be served up. This doesn't appear to be how portals should normally handle this exception.
  • Have tried in multiple browsers
  • Portal version 9.0.12.12

What's going on?

  • Am I missing something simple?
  • Is the Record Not Found Message for something else entirely, and Entity Forms simply can't handle trying to retrieve records if they don't exist?
  • Is this a legit bug?
  • Is there a workaround?

Error log entries:

error_2D00_logs2.PNG

Categories:
  • Inogic Profile Picture
    Inogic 24,055 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Hi,

    There are many reasons which might cause this type of error to occur and show the respective error message. Few of such issues have been stated in this blog. There are also scenarios where the configuration of the entity form is not proper to handle the respective relations in those scenarios also we get such error messages.

     

    I would request you to kindly re-verify the configuration of the entity form based on the relationship and the record you are trying to navigate to.

    Thanks!

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Great! Do remember to close the thread once you get this sorted :)

  • Quirk Profile Picture
    Quirk 2 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Thanks heaps Ravi. I'll give it a go on Monday.

    I found a couple more resources which may help others:

    docs.microsoft.com/.../create-custom-template

    www.engineeredcode.com/.../dynamics-365-portal-using-liquid-to-create-conditional-entity-forms

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Hi,

    I just tried this with custom web template and was able to display the custom wrror message if the account is not present. Below is my web template code.

    ==================

    {% extends 'Layout 1 Column' %}

    {% block main %}

    {% assign entity_logical_name = 'contact' %}

    {% assign contact = entities[entity_logical_name][user.contactid] %}

    {% if contact %}

     {% if contact.parentcustomerid.id %}

      {% entityform id: page.adx_entityform.id %}

      {% else %}

         <div id="MessagePanel" class="message alert error alert alert-danger error alert alert-danger">

       <span id="MessageLabel">No Records found !!!</span>

       </div>

     {% endif %}

    {% endif %}  

     {% endblock %}

    ======================

    Try this and let me know how you go with this.

    Hope this helps.

  • Quirk Profile Picture
    Quirk 2 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Hi LeoAlt,

    Thanks, but I think that is used for different types of errors... like uncaught exceptions???

    I tried it anyway - turned custom error messages on again, but it made no difference.

    I then tried creating the "Portal Generic Error" content snippet, however the docs are woefully unhelpful on the exact details of how to do this. (Has anyone implemented a "Portal Generic Error" snippet before?). I created the content snippet, named it "Portal Generic Error", but it still made no difference. It's still showing the same "An unknown failure has occurred" message.

    It's not an unknown error however. The logs show that portals knew it couldn't find the record. The entity form has a place to configure a custom message for this exact scenario, and I'm still getting an "unknown" error (with or without custom error messages enabled in the portals admin).

    Any further thoughts?

    FYI this is the content snippet I created... no idea what i need to put into the html value

    portal_2D00_generic_2D00_error_2D00_content_2D00_snippet.PNG

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Hi,

    Dynamics 365 Portal are based on the previous Adx Studio portal and I have seen couple similar issues here something is expected/supposed to work but is not working in portals just like you found it with "Record Not Found Message" not working. You might want to check the official document of D365 Portal and see if it is mentioned there or not. If it is not there that means it may not work.

    With respect to your issue, I guess you can workaround this by creating a custom template rather than leading the entity form directly i.e. create a template and where you check if the record is available or not and then based on that either display the entity form or a user defined message. I haven't tried this but believes that this should work.

    Hope it helps.

  • Suggested answer
    LeoAlt Profile Picture
    LeoAlt 16,329 on at
    RE: How do I get a friendly error in D365 portals when entity form tries to get a record which doesn't exist?

    Hi partner,

    This article describes how to customize portal error message.

    community48.png

    Hope it helps.

    Best Regards

    Leo

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,900 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,275 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans