Show custom buttons on user Registration Page in Dynamics 365 Portals/ powerApps portals

Follow my blog for more interesting topics on Dynamics 365, Portals and Power Platform. For training and consulting, write to us at info@xrmforyou.com
Recently I had a requirement where my customer wanted to put a Cancel button in the registration screen of Dynamics 365 Portal. To explain the requirement, the OOB screen looks like below.


image
What my customer wanted was to place the Cancel button beside the Register button. So that when he clicks on the Cancel button, it should throw the user back to the login page.
So let’s see how to do it.
Step 1: Create a content snippet
Go to settings –> portals –> content snippets
Create a content snippet with Name = Account/Register/PageCopy and Type = HTML. Check for the below screenshot
image
Save the record.
Step 2: Write the content of the HTML to render the Cancel button
Copy and paste the below in the Value (HTML) field

$(document).ready(function () {
$submitButton = $("#ContentContainer_MainContent_MainContent_SecureRegister").find("#SubmitButton");
$submitButton.parent().append("<input type='button' id='btn_cancel' class='btn btn-primary' value='Cancel' />");
$("#btn_cancel").click(function () {
window.location.href = "https://xrmforyou.microsoftcrmportals.com";
});

});
There is one trick here. If you just Copy/ Paste the above code in the HTML field, it will render as text on the Registration Page.


image
So the trick is to follow the below steps before copy/ pasting the above code.
Click on the Source Icon as highlighted below. Once you click, it becomes a HTML editor.
image
Now copy and past the above code.
Save and refresh your portal.
image
Hope this helps!
Debajit Dutta
(Dynamics MVP)
For corporate training/ consulting, please write to us at info@xrmforyou.com


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

8 thoughts on “Show custom buttons on user Registration Page in Dynamics 365 Portals/ powerApps portals”

    1. what is not working? button is not displaying or your script is rendering as text? did u trying putting in the debugger and check.

      1. Sir, Button is not displaying. i have n sales order for rendering from crm and on that form i have few custom button on top. As portal is not showing those button which are in crm form, so i need to put custom button in portal. I created content snippet and in that i cant see html tag as you highlighted. And i just dont see design of button. I will send screen shot, please share email sir.

  1. this is the code under html tag in content snipets sir.
    Kindly let me know, if m i doing any mistake, i cant see the design.

    $(document).ready(function () {
    $submitButton = $(“#ContentContainer_MainContent_MainContent_SecureRegister”).find(“#SubmitButton”);
    $submitButton.parent().append(“”);
    $(“#btn_cancel”).click(function () {
    window.location.href = “https://xrmforyou.microsoftcrmportals.com”;
    });
    });

    1. what I understand is you are trying to insert the button in the entity form and not on the registration page. $(“#ContentContainer_MainContent_MainContent_SecureRegister”).find(“#SubmitButton”); this code many not work at all since there may not be any html element with the same id on the form where your code is executing. This code only works on the registration form of portals

      1. How can i put custom button on the form? which pages need to be considered sir?

  2. can you guide us, how anyone can place any custom button on portal from scratch, it will help lot of people.

  3. Even i managed to get ‘Cancel button’ desig with html tags. But i have no idea how should i connect content snippet to my portal form.

Comments are closed.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading