Hello, I am trying to set a button with a dynamic ID that changes based on which case you chose. So if I chose case 1 (id 1234), I want to set the button inside that case to be casedocuments/id?=1234 but then if I go to case 2 (id 4321) the button then needs to read casedocuments/id?=4321.
Please let me know if I need to explain better.
Hi @ddanna567 ,
Assuming you've already added a button to each of your (Case Details) Web Page, let say like this:
<button id="casedocuments">Case Documents</button>
Here is one of the ways, you can get/set button id based on your record id:
$(document).ready(function () {
//Get Current Case Id (Opened)
var caseId = '{{ request.params['id'] }}';
// Select the button by its current ID and update the 'id' attribute
var formattedId = "casedocuments-id"+ caseId;
$("#casedocuments").attr("id", caseId);
});
Please note, there are other ways too, you can even create a button dynamically instead of changing button id on page load.
Feel free to reach out, if you have any question.
Thanks,
Saud
If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.
Either use JavaScript /JQuery to extract it from the window.location and update the button or use Liquid code to get the Id from the request params
https://learn.microsoft.com/en-us/power-pages/configure/liquid/liquid-objects#request
The picture attached to main post should explain better
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43