Wednesday 22 November 2017

CRM Portal - Send Confirmation Email to User after Successful Registration

Hello CRM Folks,

Currently, there is no out of box way to sent confirmation email after successful registration on Portal.

But by creating a simple System Workflow we can make this possible and send the user an email notification after successful registration.


Write a workflow on Contact Entity and Trigger it on below field change.


Add a condition 'If Login Enabled = Yes then only add a step to send email to user"














Note: 'Login Enabled' field value changes to true only one time as soon as the user clicks on Register button on Portal. So this workflow will trigger only one time when user registered on the portal.

CRM Portal - Validate that Email already exists when using "Forgot Password"

Hello Everyone,

I have been seen a lot of people were asking about 'Forget Password' strange behavior in CRM Portal.

CRM Portal provides Forget Password option like other portal or websites, that allows users to reset their password if they have either forgotten their password or triggered an intruder lockout to authenticate with an alternate factor and repair their own problem, without calling the help desk.

CRM Portal ask the user to enter an email address in order to send password reset link. But it does not check whether email exists in CRM or for duplicate contact of same email address.

You either get an error message or not receive the email due to following reasons :
  1. If multiple contacts found of same email address in CRM.
  2. If the entered email address does not exist in CRM.
  3. Is the email address written correctly in the contact and on the password reset control?
Although people have posted this in Microsoft Dynamics 365 Ideas Portal (here), but not sure whether this would be included in the future release or not. 

Solution 1 -


Enable duplicate detection rule in CRM and create a new rule to warn users to not create duplicate contact of same email address. But by doing this, you can only warn or give a message to the user but cannot restrict from contact creation of same email address.

Also, by doing this you can only check for duplicate contacts of same email address, not whether the user exists or not.

Solution 2 -


Create a new Content Snippet record


Name - Account/ForgotPassword/PageCopy
Website - <website name>
Value - text


Hide, out of box Send button and create your own custom button


$(window).load(function() {

$('#submit-forgot-password').hide();

$('#submit-forgot-password').after('<input type="button" value="Send" id="checkemailId">');

// You can apply the CSS as well on the button by adding a Style tag to it.

});

Write OData query to check for duplicate contacts of same email address and to check whether email id exists in CRM or not.


Refer below article if you are not aware how to use the OData in Portal.

http://arpitmscrmhunt.blogspot.in/2016/12/adxstudio-portal-how-to-use-odata.html


Put it inside the window.load function.

$('#checkemailId').click(function () {

var inputEmailAddres = $("#Email").val();

var odataurl= "~/_odata/contacts?$filter=emailaddress1%20eq%20%27" + inputEmailAddres + "%27%20or%20emailaddress2%20eq%20%27" + inputEmailAddres + "%27";

            $.ajax({
                type: "GET",
                url: odataurl,
                dataType: 'json'
            }).done(function (json) {

                 var contactsColl = json.value;

                 // If multiple email id found
                if (contactsColl.length > 1)
                {
                     alert("Multiple Contact Foundof entered email address");
                }
                 // If Single email id found
if (contactsColl.length == 1)
                {
                   $('#checkemailId').val('Sending...');
                    $('#submit-forgot-password').click();
                }
                // If email id not found
if (contactsColl.length == 0)
                {
                     alert("Entered Email Id does not exist in system");
                }

            })
});

Sunday 12 November 2017

window.parent.Xrm.Page.data.entity.getId() is not working in CRM 2016 and Dynamics 365

I have been seen a lot of CRM folks is struggling to find the syntax of getting Parent record details from Child record in CRM 2016 and above.

Syntax to get Parent record details from Child form in CRM above 2016 version :

window.top.opener.frames[0].Xrm.Page.data.entity.getEntityName();


window.top.opener.frames[0].Xrm.Page.data.entity.getId();


window.top.opener.frames[0].Xrm.Page.data.entity.getId();


window.top.opener.frames[0].Xrm.Page.getAttribute("attributename").getValue();


Cheers
Blogger Widgets