Showing posts with label Connection. Show all posts
Showing posts with label Connection. Show all posts

Wednesday, January 12, 2011

Connections Role in CRM 2011

CRM 4.0 provided the ability to define the relationship between entities using the Relationship feature. However this was only available for defining relations between Account, Contact and Opportunity. This concept has been enhanced further with the introduction of Connections in CRM 2011. Moreover, this has now been extended to include any entities including custom entities that you define.

Connections can basically be used to define the relation or the association between two entities. To give an example you can have an account with multiple contacts. With the help of connection you can define that one of the contact is actually the partner in the company and another an employee.

One can define any number labels for the relationships Like:

Family relationships (father, sister, brother, spouse/partner, cousin)
Social relationships (tennis partner, golf partner, club member, friend)
Sales relationships (champion, influencer, stakeholder, referrer, gatekeeper)
Business relationships (supplier, partner, consultant, contractor, competitor, former employer)

When you create a connection role, you can select the CRM entities for which this connection role can be used. In the below example we have created a role called “Employer” and made it available to be associated with the Account entity.


After users choose the records that will participate in the relationship, they can select from available labels in the respective relationship form. Only valid labels based on the definition of the entity types in the relationship role are displayed.

Managing Relationship roles is the task of choosing the labels that will represent valid options when users define these types of relationships. When you define the labels, you also define which combination of account, contact, or opportunity records will be valid for the label. Setting consistent relationship roles allows users to select meaningful labels for the relationship roles they set that can be used in a report or an Advanced Find query.

Users are not required to choose labels when they set relationships. They can just enter a description in the relationship.

To enable the Connections Role on any entity we need to permit to create connection at the entity level. As shown in the below screenshot.


Once Connections is enabled for an entity it cannot be disabled.

How to Create Connections for the Related records in the CRM 2011:

To Create the connection Open an account and go to Connections and click on the Connect  To Another. As shown in the below screenshot.

In the following window you can enter the related entity along with the role that needs to be associated.

You can see this same connection on the related record as well as shown below.


Hope this helps!

Thursday, March 5, 2009

How to Login to various CRM deployments

CRM supports various Deployment methods and unfortunately for the developers the method to connect to each of these differs. So here are the login functions for each of the Deployment methods supported by Dynamics CRM.

On Premise CRM connection:

On premise uses AD for authentication.

CrmService service = new CrmService();

service.Url = "http://" + servername + "/mscrmservices/2007/crmservice.asmx";

service.CrmAuthenticationTokenValue.OrganizationName = "orgname";

service.CrmAuthenticationTokenValue.AuthenticationType = 0;

service.Credentials = new System.Net.NetworkCredential("username", "Password", "DomainName");

OR

crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;


Live CRM connection:

CRM Live uses Passport authentication. It requires a reference to the Idcrlwrapper be added. The Idcrlwrapper is available along with the SDK as helper files.

Make sure you have copied the msidcrl40.dll to the system32 folder before you try to run this code.

CrmDiscoveryService discoveryService = new CrmDiscoveryService();
discoveryService.Url = "https://dev.crm.dynamics.com/MSCRMServices/2007/Passport/CrmDiscoveryService.asmx";

RetrievePolicyRequest policyRequest = new RetrievePolicyRequest();

RetrievePolicyResponse policyResponse = (RetrievePolicyResponse)discoveryService.Execute(policyRequest);

// Retrieve a Windows Live ticket from the Live
service.LogonManager lm = new LogonManager();

string passportTicket = lm.Logon("LiveWindowsUserId", "password", "crm.dynamics.com", policyResponse.Policy, "Production");

RetrieveCrmTicketRequest crmTicketRequest = new RetrieveCrmTicketRequest();

crmTicketRequest.OrganizationName = "OrganizationName";

crmTicketRequest.PassportTicket = passportTicket;

RetrieveCrmTicketResponse crmTicketResponse = (RetrieveCrmTicketResponse)discoveryService.Execute(crmTicketRequest);

CrmAuthenticationToken token = new CrmAuthenticationToken();

token.AuthenticationType = 1;

token.CrmTicket = crmTicketResponse.CrmTicket;

token.OrganizationName = crmTicketResponse.OrganizationDetail.OrganizationName;

Now, once you have the token assign it to the crmservice object as we do in on premise.

Hosted CRM connection:

This uses SPLA authentication. You need to use the userid and password provided to you by your hosting provider. You would also need to get the discovery URL from them.

From the discovery service URL you can retrieve the list of organizations.

RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();

orgRequest.UserId = username;

orgRequest.Password = password;

RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)disco.Execute(orgRequest);

//Find the desired organization with which you want to connect.
//Retrieve the ticket.

RetrieveCrmTicketRequest ticketRequest = new RetrieveCrmTicketRequest();

ticketRequest.OrganizationName = organization;

ticketRequest.UserId = username;

ticketRequest.Password = password;

RetrieveCrmTicketResponse ticketResponse = (RetrieveCrmTicketResponse)disco.Execute(ticketRequest);

//Create the CrmService Web service proxy.
CrmAuthenticationToken sdktoken = new CrmAuthenticationToken();

sdktoken.AuthenticationType = 2;

sdktoken.OrganizationName = organization;

sdktoken.CrmTicket = ticketResponse.CrmTicket;

Now, once you have the token assign it to the crmservice object as we do in on premise.