Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 79901

Portal - Using Liquid variables within Entity List custom javascript

$
0
0

Hi all,

My scenario is that I have an entity list and within its custom JavaScript I can filter rows out based on attributes in the view. So a basic example is like this. Note I'm using liquid to get the logged in users id. 

$(document).ready(function (){
var user = '{{user.id}}';
console.log("user: " + user);
$(".entitylist.entity-grid").on("loaded", function () {
$(this).children(".view-grid").find("tr").each(function (){
var qualaimcode = $(this).find('[data-attribute="aa.uow_qualificationaimcode"]').attr("data-value");
if (qualaimcode == "25") {
//$(this).css("background-color", "yellow");
$(this).remove();
}
});
});
});

Running this will show the users contact id in the dev console.

The web template displaying this entity list is currently using the OOB page template 'Web Form' which is of type 'rewrite' and therefore not customizable.


I want to use a web template rather than a rewrite template so i can use a fetchxml query to get related entity data for the logged in user

 but on doing this i find that {{user.id}} in my custom JavaScript is now treated as text.

Looking into this it seems that when using web templates any liquid code does not get evaluated.


So how do I get around this? I need to filter my entity list based on the 'qualaimcode' of the currently logged in user. I can get this info

via liquid template but don't seem to be able to use it to filter within my entity list custom JavaScript.


Thanks.


Viewing all articles
Browse latest Browse all 79901


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>