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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Service | Customer Service, Contact Center, Fie...
Suggested Answer

Display Web Page based on logged in portal contact

(0) ShareShare
ReportReport
Posted on by 255

Hi all,

I have a requirement in which there are two Case forms Case1 and Case2 and there are 2 contacts and these belongs to 2 different companies. I have to display Case1 form whenever contact1 is logged in into the customer portal and similarly for Case2.

I have created 2 separate web pages and assign these 2 Case forms to it. Also Created 2 Web roles wb1 and wb2 and assign it to both the contacts.
I have also created 2 Web access roles and assign it to the both web pages.
There is a button which creates Case record. Now, the question arises how can we integrate these 2 web pages with this button.

pastedimage1588577288970v1.png

I need help to display web pages based on logged in contact user. 

I have the same question (0)
  • Suggested answer
    Harish M Profile Picture
    Microsoft Employee on at

    Hi Anant,

    You will have to use liquid code or JavaScript to achieve this by editing the web page templates or placing the JavaScript on the webpage that is used to expose the Case create entity form.

    You can use the user object to validate the current logged in user webrole

    Example : {% if user.roles contains 'wb1'%}

    Best Regards,

    Harish M

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums

  • Anant Profile Picture
    255 on at

    Hi,

    I have created a web template and written down following script to be used on web page.

    <!DOCTYPE html>

    <html>

    <body onload="myFunction()">

    <script>

    function myFunction() {

       var role = "{{user.role}}";

       if(role.includes("wb1"))

       $('#case1').show();

        else

         $('#case2').show();

    }

    </script>

    <div id="case1" style="margin-top:10px;width:100%; display:none">

    {% entityform name: 'Customer Service - Create Case' %}

    </div>

    <div id="case2" style="margin-top:10px;width:100%;display:none">

    {% entityform name: 'Customer Service - Create Case1' %}

    </div>

    </body>

    </html>

    But, showing following error on portal:

    Test B (Text Field): An entry with the same key already exists.

  • Harish M Profile Picture
    Microsoft Employee on at

    Hi Anant,

    I would recommend you to open a ticket with Microsoft Support for this. As this needs to be investigated.

    Best Regards,

    Harish M

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Service | Customer Service, Contact Center, Field Service, Guides

#1
KristineRisberg Profile Picture

KristineRisberg 37

#2
11manish Profile Picture

11manish 35

#3
Manoj - ManoVerse Profile Picture

Manoj - ManoVerse 21 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans