Monday 10 April 2017

Access Quick View Form values using JavaScript - CRM 2016

Quick view forms in Dynamics CRM 2016 allow you to display all the related entity information.

Is there a way to retrieve the field value on Quick View Form using JavaScript without additional
OData call to the associated entity?

The answer is Yes and here is the sample JavaScript to achieve the same:


function getQuickViewFormAttributeValues() {

    var quickViewControl = Xrm.Page.ui.quickForms.get("<QuickViewControlName>");

    if (quickViewControl != undefined)
    {
        if (quickViewControl.isLoaded())
        {
            // Access the value of the attribute bound to the constituent control
            var myattrValue1 = quickViewControl.getControl(0).getAttribute("<attribute name>").getValue();

            var myattrValue2 = quickViewControl.getControl(1).getAttribute("<attribute name>").getValue();

            console.log(myattrValue1 + myattrValue2);

            return;
        }
        else
        {
            // Wait for some time and check again
            setTimeout(getAttributeValue, 10);
        }
    }
    else
    {
        console.log("No data to display in the quick view control.");
        return;
    }    
}

CRM 2016 - How to Compare Two Dates Using JavaScript

I have encountered many confused developers attempting to compare two dates using JavaScript. There are many methods or algorithms for comparing dates but I am showing the simplest ways to compare dates as well as times using JavaScript.


This article will help you to resolve problems to compare two Dates using JavaScript :



<script type="text/javascript"language="javascript">

   function CompareDates() 
   {      
       var dateOne = new Date("2017/04/12"); //Year, Month, Date
       var dateTwo = new Date("2017/05/12"); //Year, Month, Date
       if (dateOne > dateTwo) 
        {
            alert("Date One is greater then Date Two.");
        }
        else
        {
            alert("Date Two is greater then Date One.");
        }
    } 
    CompareDate();
</script>

Sunday 2 April 2017

LinkedIn Integration with Dynamics CRM Portals or Adxstudio Portals

LinkedIn plays a big role in the professional industry as this application really has a huge network, and lots of businesses uses this to build new relationships with customers, as well as prospect companies.  LinkedIn integration with CRM Portals or Adxstudio Portal lets you Sign In on Portals with LinkedIn Account as a External or Federated Account.

CRM Portals provide you the provisions of authentication mechanism using External Providers like :

  • Microsoft Account
  • Twitter
  • Facebook
  • Google
  • LinkedIn
  • Yammer
  • Yahoo

Today in this article, I am going to explain steps to configure CRM Portals to logged In with LinkedIn account.

Step 1: Create a new Dynamics CRM 365 trial instance (if you have not already made).

Step 2: Configure and Install CRM Portal as per your need (I have installed Customer Self-Service Portal). You can go through below link to configure Portal in Dynamics CRM 365.

http://arpitmscrmhunt.blogspot.in/2016/12/set-up-crm-portal-in-dynamics-crm-365.html

Step 3: Open LinkedIn Developer Network

Step 4 : Click 'Create Application' with below details :

  • Specify an Application Name, Description, etc.
  • Website URL: http://portal.contoso.com
  • OAuth User Agreement/Default Scope: r_basicprofie and r_emailaddress
  • OAuth 2.0 Redirect Urls: http://portal.contoso.com/signin-linkedin
  • Click Add Application
Step 5 : Once your are done by creating Application, You will be able to see below screen:




Step 6 : Now it's time to create some Site Settings in CRM:

You can get the below site settings from Adxstudio Community.

Site Setting NameDescription
Authentication/Registration/ExternalLoginEnabled
Enables or disables external account sign-in and registration. Default:true
Authentication/OpenAuth/[provider]/ClientId
Required. The client ID value from the provider application. It may also be referred to as an "App ID" or "Consumer Key".
The following setting names are allowed for backwards compatibility:
  • Authentication/OpenAuth/Twitter/ConsumerKey
  • Authentication/OpenAuth/Facebook/AppId
  • Authentication/OpenAuth/LinkedIn/ConsumerKey
Authentication/OpenAuth/[provider]/ClientSecret
Required. The client secret value from the provider application. It may also be referred to as an "App Secret" or "Consumer Secret".
The following setting names are allowed for backwards compatibility:
  • Authentication/OpenAuth/Twitter/ConsumerSecret
  • Authentication/OpenAuth/Facebook/AppSecret
  • Authentication/OpenAuth/LinkedIn/ConsumerSecret



Step 7: Once you done with these Site Settings configurations (under Portal > Site Settings) in CRM. You will be able to see LinkedIn Option on CRM Portal Sign In page.

























Step 8: As soon as you will click on LinkedIn, you will be redirected to LinkedIn Authenticated page for authentication



Step 9: Enter your credentials and click on 'Allow Access'. You will redirected now to Portal Profile page in order to complete your Registration.
Complete your registration by filling the given information and do click on 'Update', You will be redirected to Portal home page











Blogger Widgets