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,...
Unanswered

How to write a code in portal d365 ?

(0) ShareShare
ReportReport
Posted on by 45

Scenario : I have made a custom customerself service portal and in that portal when i have logged in 

Screenshot-_2800_411_2900_.png

Supposing i am the admin i should be only able to see the "open the new case "other logged in  users shouldn't be able to see it

This however can be achieved using liquid can anyone tell me from where we can write the code or get liquid code tutorial 

For reference i have used the code but i dont know whether its correct or not 

% if user.roles contains 'Administrators' %}
    {% open a new case: 'Entity Form with Button' %}
{% else %}
    {% open a new case: 'Entity Form without Button' %}
{% endif %}

I will be highly obliged if someone resolves my query 

Thanks and Regards,

Ainee Ahsan

I have the same question (0)
  • CRMJetty Profile Picture
    3,514 on at

    Hi  Ainee,

    In regards to your concerns, you may hide/show button by using custom JS. You can use class to hide/show button.

    To add custom JS, log in into portal with Administrator role, then from the edit portal popup click on Edit , the page setting popup will open. From the page setting popup, click on Options. Add your JS code in Custom JavaScript section and save it. After save your JS code logic will apply for the page.

    pastedimage1623059091731v2.png

    JS Code:


    $( document ).ready(function() {
           var userRole='{{user.roles}}';
           if(userRole.indexOf("Administrators") != -1)
           {
                    $(".entitylist").find(".create-action").first().parent().show();
           }
           else{
                    $(".entitylist").find(".create-action").first().parent().hide();
           }
    });

    References for write liquid template language code:

    https://sank8sinha.wordpress.com/2020/07/18/get-start-with-writing-liquid-templates-in-dynamics-powerapps-portal/
    https://docs.microsoft.com/en-us/powerapps/maker/portals/liquid/liquid-objects
    https://docs.microsoft.com/en-us/learn/modules/liquid-template-language/
    https://sank8sinha.wordpress.com/2020/07/27/liquid-code-tipscode-snippets-for-dynamics-portal/
    https://www.engineeredcode.com/blog/powerapps-portals-liquid-and-javascript-better-together

    I hope it helps,

    Thanks.

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

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 128 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 97

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans