Showing posts with label Microsoft Dynamics CRM. Show all posts
Showing posts with label Microsoft Dynamics CRM. Show all posts

Wednesday, 30 January 2013

CRM 2011 On Premise Customer Portal - Authentication by Active Directory

Hi all,

Since, last few days, I found out many people struggling with how to configure Customer Portal for CRM On Premise without using Window Live ID. So today, I am going to show you guys how to configure Customer Portal for CRM On Premise and using Active Directory authentication instead of using Window Live ID (which is for CRM Online).

Here is the step by step:

1. Download the Customer Portal for CRM 2011 - using AD from this blog:
http://community.adxstudio.com/blogs/shan/customer-portal-modifications/

That's is the Zip file of Customer Portal CRM 2011 (as you could download from pinpoint also). However, in this version, the blog author changed some codes and configuration values inside, which will help you to use the Active Directory authentication for the portal.

2. After unzip the folder, please navigate to the "Documentation" folder, open the "Customer Portal Deployment Guide_OnPremises_V2.0" file. Start from "Deployment Steps", you now follow the document from step 1 to step 3:
     - Step 1: Follow the document to import the solution into your CRM.

     - Step 2: You could skip this step. No need to do anything with it.

     - Step 3: Going your "SDK" folder (you should download SDK for CRM from Microsoft Source) --> Tools --> WebsiteCopy --> launch the "WebsiteCopy.exe" file. And follow step by step in the document.
      Note: in the end of the copy website process, the wizard will ask you to copy the "connectionString", you please copy it to somewhere.

So in the end of this stage, you have your Customer Portal in CRM as shown in below image !


3. In the "Customer Portal" folder (which you unzip at step 2), navigate to CustomerPortal --> Web --> Web.config file. Open the file, look at the "connectionStrings" part and especially the bold lines:

 <connectionStrings>
    <add name="Xrm" connectionString="ServiceUri=http://crm2011/Contoso; Domain=CONTOSO; Username=webportal;
Password=pass@word1"/>
    <add name="ADConnectionString" connectionString="
LDAP://contoso.com/CN=Users,DC=contoso,DC=com" />  
  <!--<add name="Live" connectionString="Application Id=0000000000000000; Secret=00000000000000000000000000000000"/>-->
    <!--<add name="Bus" connectionString="Service Namespace=???; Service Path=???; Issuer Name=???; Issuer Secret=???; Include Exception Detail In Faults=true"/>-->
  </connectionStrings>


Now, you need to change the connectionString (bold lines) into the correct: CRM URL (http://crmserver-name/domain-name), Domain, Username (of administrator, for example) and password. For the next line, do the same thing, change URL, Username, Domain (DC).

**Note: The username here should be the one has been created in AD, so later this AD account will be used to login the portal via AD Authentication.

4. In the same server, open IIS Manager (Internet Information Services):

- Navigating to "Sites" node, click right mouse to create a new website. Give approciate name for the website and put the physical path as the file in Customer Portal folder.

- After creating the website, right click on it in Application Tool tab, change the .NetFramework version to v4.030319.


  
- Finally, try to browse your website in IIS, now the portal will work and it connected to your CRM, using AD Authentication !


I hope the post is useful for you guys ;)
 

Thursday, 9 February 2012

Create,Update,Retrieve, RetrieveMultiple Records in CRM 2011 with Javascript REST endpoint

Hi,

For who are new with Microsoft CRM 2011, this is a first lession that you should know: How to create, update, retrieve and delete a record of an entity in CRM by using javascript. These basic operations help you a lot in developing your CRM by using the client-side language Javascript.

There are two ways to achieve the results:
1. Using directly the REST Endpoint method like in SDK sample in this link: http://msdn.microsoft.com/en-us/library/gg334427.aspx --> for me, this way is complicated, because you have to bring the whole REST Endpoint function to your code, which makes your code like a mess.

2. Download the REST Endpoint method from SDK  and use it like a library for your javascript code.

Now are steps how to do the second way:

- Step 1: Prepare the following required js:
       + JavascriptRESTDataOperations --> from SDK: SampleCode\JS\RESTEnpoint\JavascriptRESTDataOperations
       + jquery1.7.1.js --> from http://jquery.com/
       + json2.js --> from http://www.json.org/json2.js

- Step 2: Creating your javascript as following:

//Create record
function Create_CRMObject()
{ var CRMObject = new Object();
  CRMObject.Id = "";
  //createRecord function is in jsoperation.js
  createRecord(CRMObject,"your entity set name", createCRMObjectCompleted,errorCreate) 
  // entity set name, for example: AccountSet, ContactSet, etc
}
createCRMObjectCompleted = function (data, textStatus, XmlHttpRequest)
{ var newCRMObjectCreated = data["d"];  
}
errorCreate = function (XMLHttpRequest, textStatus, errorThrown) 
{ alert("Error");
}

//Update record
function Update_CRMObject()
{ 
    new CRMObject = new Object();
 var CRMObject_Id = "put the GUID here";
 var CRMObject."Attribute" = "put any attribute value here"
 //updateRecord function is in jsoperation.js
 updateRecord(CRMObject_Id,CRMObject,"you entity set name", updateCRMObjectCompleted,errorUpdate); // entity set name, for example: AccountSet, ContactSet, etc
}
updateCRMObjectCompleted = function (data, textStatus, XmlHttpRequest)
{ alert("your update is successful");  
}
errorUpdate = function (XMLHttpRequest, textStatus, errorThrown) 
{ alert("Error");
}

//Delete Record
function Delete_CRMObject()
{  var CRMObject_Id =" put the GUID here");
   //deleteRecord function is in jsoperation.js
   deleteRecord(CRMObject_Id,"your entity set name", deleteCRMObjectCompleted, errorDelete);   
}
deleteCRMObjectCompleted = function (data, textStatus, XmlHttpRequest)
{}
errorDelete = function (XMLHttpRequest, textStatus, errorThrown) 
{ alert("Error");
}

//Retrieve Record
function retrieve_CRMObject()
{ //retrieveRecord function is in jsoperation.js
   retrieveRecord("put your record GUID here","put your entity set name", retrieveCRMObjectCompleted, errorRetrieve);
// entity set name, for example: AccountSet, ContactSet, etc
}
retrieveCRMObjectCompleted = function (data, textStatus, XmlHttpRequest)
{ var newCRMObjectRetrieve = data["d"];
  //now you could retrieve any field belongs to your record
}
errorRetrieve = function (data, textStatus, XmlHttpRequest) 
{ alert("Error"); 
}

//Retrieve Multiple Records
function retrievemultiple_CRMObject() 
{  retrieveMultiple("your entity set name","", retrievemultipleCRMObjectCompleted, errorRetrieveMultiple);
// entity set name, for example: AccountSet, ContactSet, etc
}
retrievemultipleCRMObjectCompleted = function (data, textStatus, XmlHttpRequest)
{ var CRMObject = data;
  if (CRMObject.length !==0)
   { for (i=0, i<CRMObject.length, i++)
      { CRMObject[0].id = ... //retrieve any field you want
   }   
   }
  else
  { alert("no record");
  }
}
errorRetrieveMultiple = function (data, textStatus, XmlHttpRequest) 
{ alert("Error"); 
}

Save all of above code in CRMObject.js

- Step 3: Add all 4 above js files in your entity's form. Put the function name for onload or onsave event. Then you could do anything you want now !

I hope it helps. Please email to linhhk87@gmail.com if you have any further question to implement it !




    

       

Tuesday, 31 January 2012

Creating embedded grid between parent & child entities in CRM form

Last time, I spent 2 days to figure out how to create an embedded-grid showing "child" entities which are related to a parent entity as the following picture:


As you see, in Campaign Activity entity (which is a parent entity), there are many Email entities (which are related entities). So now, I would like to create a navigation when clicked will show you related entities like that.

The key thing needed to understand is: actually, when you create a relationship bet when 2 entities (such as: Campaign Activity & Email), there is an exsiting "tabset" which stores all related entities created. The navigation link just let us to that tabset only. So the task now is: building url to the tabset.

Here is the javascript how to build the navigation link to get the embedded-grid:
function passURLtoNavigation()
{ //Gets navigation item
   var items = Xrm.Page.ui.navigation.items.get();
   for (var i in items)
    {
       var item = items[i];
      var label = item.getLabel();
      if (label == "Email Created")
          { var navId = item.getId();
            var navItem = document.getElementById(navId);
            if (navItem != null && navItem != undefined)
              { var serverUrl = location.protocol + '//' + location.host + '/' +     Xrm.Page.context.getOrgUniqueName();
          var oId = Xrm.Page.data.entity.getId();
          var oType = Xrm.Page.context.getQueryStringParameters().etc;
          var security = "852023";
          var tabSet = "//here is your relationship name";       
                   //building the URL for the navigation link
                   var navUrl = encodeURI(serverUrl + "/userdefined/areas.aspx?oId=" + oId + "&oType=" + oType + "&security=" + security + "&tabSet=" + tabSet);
                   navItem.onclick = function () { loadIsvArea(Mscrm.CrmUri.create(navUrl), false ); };
}
}
}
}

So now, you have the subgrid as shown in the first picture. I hope it will be helpful.

Thursday, 29 December 2011

Hello world !

My name is Kelly Hoang. I am Vietnamese and now working in Singapore as a Technical Consultant, specializing to Microsoft Dynamics CRM and Business Intelligence. I have officially joined the professional industry only 2 months, such a new bie :). However, I realized that during the way I am gain knowledge and experience Microsoft CRM 2011 in particular and Customer Relationship as well as BI in general, there are many things I would like to share for those who are new (or might be old, hopefully in the future) and interested in this area. So welcome to my brand new world. It might be very simple, but I believe it will be useful somehow. Cheers !