Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Javascript code and List control, some issues.

Hello community,

i started to create my own power apps portals frem blank portal and i'm struggling with few issues at the moment:

1. My javascript code won't runs, i wrot really simple html and javascript jquery code, that works alone but after pasting it to potals source code js stop working:



<h1>Current weather</h1>
<label for="fcity">City:</label>
<input type="text" id="fcity" name="fcity"></input> <br><br>
<button id="actionButton" style="width: 80px; height: 30px" type="button">Click</button>

<div id="result" style="display: none">
   <img id="conditionsImage" src="" />
   <div id="conditions"></div>
   <div id="temperature">Temperature: <strong>...</strong> C</div>
   <div><a href="#" class="hide">Hide</a>






$(document).ready(function() {
            $("#actionButton").click(function() {
              console.log("Happend or not?");
            function getWeather() {
              var city = $("#fcity").val();
              $.ajax("" + city, {
                dataType: 'json',
                success: function(json) {
                  console.log("It's happend");
                  $("#conditionsImage").attr("src", "https:" + json.current.condition.icon);
                  $("div#temperature strong").text(json.current.temp_c);
                error: function(json) {
            $('a.hide').click(function(e) {



When i run this html as just standalone html files everything works, after pasting it to portal it stop working. Html looks fine but but after click on button nothing happen (even consol logs won't appear on console). I try to paste javascript directly into source code in <script> tags and also as a custom javascript to Web Page from Portal Management app. Both approaches failed. Should i enable custom javascript somehow or create some site settings ?

2. I have created List from my custom CDS entity, on list cotntrol i want to enable all actions create/view/edit and delete.  But Only Create and View appear, edit/delet are not visible i don't now why. My List options configuration in portal managment app looks like that:
Options config.PNG

But in browser when i run portal i show only View action, i'm on global amdin account so i shoul had all permision to edit and delete entities:
Lack options.PNG

3. This is rather question than issue, when i click on Show action i'm redicrect to another page, CDS Id is passed as query parameter: /services/product-a/?id=4fe7b456-1424-eb11-a813-000d3a25e75a

How to use this Id to get and display CDS entities fields on this page i should use liquid or javascript to display CDS entity fields, you know any tutorial or documaentation hwo to correctyl implement this view page ?

Let me know if you need better clarification.
Thanks a lot

Solution Sage
Solution Sage

1. not much help on this one from me - no idea what you are actually doing or how you have setup your HTML - is this in a Web Template or are you just pasting it into a Content area on a Web Page etc? at the end of the day the you should be able to debug it like a normal Web Page once its rendered.


2. Global Admin account means nothing to the Portal.  You need to have a Web Role against your Contact record that contains the relevant entity permissions set.  When you make your changes make sure you clear the Cache and/or Config on the Portal (sometimes your changes do not ripple through immediately), be logged in with the Administrator Web Role and go to <your portal url>/_services/about and then click the relevant button(s) [don't do the reindex one as its not relevant for your issue]


3.  Usually you configure a form against the relevant entity in CRM/CDS with the fields you want to display.  Then in Portal Management you configure an Entity Form  that uses the form you configured, see (mode and record source is how the id is used).  However, if you were doing more advanced stuff with the new WebApi then there is a lot more that you could do.




Frequent Visitor

Thanks for you:

1. What i'm try to do here is a call to external Weather API an display respons on page. I just create ne blank page in my portal i past HTML and JS which i present in my post. JS code won't work, even when i just paste console.log("Hello world") nothing displays on my console. Page don't run any script i write. I try pase my Javascript to page content and also into page Custom Javascript section.

2. Ok when i create entity permission with scope global, set all privileages and assing it to Authenticated Users web role, when i type url i can open edit form with relevant entity but on my list options to edit or delete still are not visible. Entity permission are granted but stil my entity list don't show me only Details options but no edit or delete.

3. Ther are any demo/documentation that shows how to use this new WebAPI ?

Solution Sage
Solution Sage

1.   Your code above works for me and shows content for when I put New York in as the city.  a)  your HTML above needs a closing DIV, b) paste your JavaScript in the "Advanced" tab on the local Web Page (if you put it in the content you probably need to wrap it in <script> tags, c) if no value in City the weather web call returns an error in the Browsers debugger.

2. If you have cleared the cache/config, then it is probably something to do with the Web Page that you are directing to (or what you are displaying on those pages) and the permissions to it)



Frequent Visitor

1. I noticed that source code editor cut of my id, attributes from html tags, i had also some error in html, now everything works correct.

2. In this case i had entity permission created and assing to Authenticated Users role but it doesn't works. When i create new Web Api User role and assing it to usr and permission actions EDit and Delete finally shows up !. But when i swich my language to espanol i show only view action again.

3. I see that PUT/POST/DELETE actions are described but what about GET ? I want to create custom view screen with complex UI, but i don't know how to create page that get cds entity id in parameter, get whole entity and display values into html, without using andy cds forms. It is possible ?

Thanks for your help

Solution Sage
Solution Sage

2. I haven't played with language changes, so can't help much more with this one.  

3. you may need to get familiar with Liquid code.  You can embed a FetchXML query into your Templates that will retrieve data from CDS when the page loads. (and there are other workarounds for making other more dynamic calls but this requires you to understand Liquid and fetchxml tag and Template usage first). edit: you can see a fetchxml example on that operations page in Step 3) 14.

Helpful resources

October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!



Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Ignite 2022


Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Carousel Community Blog

Check out the Community Blog

Read all about the most recent blogs in the community!

Users online (3,768)