Tuesday, 29 October 2019

Add a custom button on Web Page - Dynamics 365 CE Portals


Today when I was working on Portals, I got a requirement to add a cancel button beside Submit button on EntityForm and user has to navigate back to EntityList when click on it.

We can quickly do this by adding some script on the WebPage. Open the required WebPage and there is a tab named as Advanced and add the below code. I have used SiteMarkers to navigate. 

$(document).ready(function () {
    $('#InsertButton').after('<button id="cancelbutton" type="button" class="btn btn-primary button" style="margin-left:10px;"><span></span>Cancel</button>');
    $("#cancelbutton").click(function () {
        window.location.href = "{{ sitemarkers['ML_CustomEntityList'].url }}";


Make sure you add the same piece of code in all Content Pages. 

Hope this helps.

Happy 365'ing

No comments:

Post a Comment