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

Thursday, February 4, 2010

Sharing access in Dynamics CRM

Dynamics CRM has the concept of record ownership. A record can only be owned by single user and not by a team or more than one users. Depending on the security roles defined it is possible to restrict a user to have access to only records owned by them.

However in most practical situation where people work in teams it would be required to allow a group of persons to have access to certain records in addition to the records owned by them. In such case you can use the concept of “Sharing” that is available in Dynamics CRM. Note when you share a record with a group you are only making the record accessible to them and for all other purposes the owner is still the original user and a single user at that.

To share records, first select the records you want to share. On the Actions toolbar, click More Actions, and then click Sharing. As shown in the below screenshot.





When you share a record, you can define the level of permission that you would like to provide the other users with whom you wish to share the record.



Now in the above screen a record has been shared with Brian giving him all permission to the record except delete. This enables Brian to be able to view this record in the Active Records view and also update the record or create activities for this record.

However Anton can only see the record in his active view. But when he open the record it will be available in read-only mode and he would not be able to make any changes to this record.

Programmatically the sharing is controlled by SecurityPrincipal object. To get a list of users/teams with which a record has been shared you will need to use the RetrieveSharedPrincipalsAndAccess message. This message needs to be provided with the TargetOwned Class. If you provide an instance of an account to this message. It will return an array of PrincipalAccess class that will list out all the users/teams and the level of access of each of these on the entity provided. This message can be excuted using the Execute method of the CRM service class.

Other messages to look out for are
GrantAccessRequest
ModifyAccessRequest
RetrievePrincipalAccessRequest

-------------------------------------------------------
Posted by: Inogic
For more information/discussions (documents, sample code snippets, detailed work flow or diagrams),
Please be free to visit the following links or email us:
Web: http://www.inogic.com
Blog: http://inogic.blogspot.com
Email: news@inogic.com
-----------------------------------------------------

Monday, January 25, 2010

InoDashboard – Dynamics CRM Business Intelligence Dashboard released

Dynamics CRM requires a comprehensive tool for monitoring the KPI in a visual/dashboard format. Inogic labs has come up with InoDashboard, a Business Intelligence Dashboard designed for Microsoft Dynamics CRM to fill in this gap. This tool will allow the CRM users at each level to design a dashboard specific to them and include the reports and monitor areas specific to their interest.

It comes along with a pre-packaged bundle of about 40+ reports that provide you with the most commonly requested reports for monitoring the KPI. Whats more is that with the wizard kind of UI it is very easy to develop your own custom reports/charts with basic knowledge of writing SQL queries. The Dashboard can be seen as below screen shot.


Its feature set includes

  • Easy to create reports to analyze your CRM data.
  • No learning curve required. Use your SQL query writing skills to design reports.

  • Ability to add CRM reports, views, custom website URL
  • User personalization available.
  • Secured reports. Pre-defined reports use Filtered Views to force inbuilt CRM security.
  • Ability to drill down to CRM entity forms.

Technical details

  • It is developed using .NET Chart control for designing the various charts
  • It makes extensive use of Web parts to support personalization
  • It supports the following types of charts shown in the screen shot.

  • It supports Dynamics CRM 4.0 On-premise with IFD

  • We have come up with this after a lot of research in this area some of our r n d was put up in our earlier blogs http://inogic.blogspot.com/search/label/Dashboards where we studied the various ways in which a dashboard could be presented in Dynamics CRM.

    Wednesday, November 18, 2009

    Tips on using Mail Merge Functionality in Dynamics CRM

    Like most Contact Managers, Dynamics CRM too provides the Mail Merge ability. Recently we spent quite some time trying this out and we would like to share some of the findings that I am sure would assist other beginners in this area

    1. Mail Merge functionality has been added as a privilege and so only users with the necessary privileges would be allowed to perform a mail merge. Mail merge is also available through the Web interface.

    2. When the Mail merge process opens the Microsoft Word window to allow for designing of the Template make sure of the following

    a. Enable Macros


    b. Make sure the CRM addin is enabled and you have to click on this for the CRM mail merge to begin.
    3. Though Mail merge can be used from Web interface as well, having Outlook client installed brings up some additional features like ability to “Upload” the mail merge template directly to CRM.



    4. There are two ways to upload Mail Merge templates to CRM, one being design the template using the “Create Mailmerge template” button in MS word.

    Save the Template file in Microsoft Word XML format.
    Attach this document to CRM.
    If you had the CRM Outlook client installed and Outlook running, the Word Mail merge wizard would display the “Upload Template” option.


    Choosing this would automatically upload the document to CRM.

    5. Mail Merge functionality is available for only selected System entities like
    · Quote
    · Lead
    · Opportunity
    · Account
    but all custom entities are available for selection for Mail Merge

    6. Only for the Quote entity would you find the “Related Products” entity in the data fields selection window.

    No other one-to-many relations of any entity would be available for mail merge. However all lookup attributes would have their related entities available for selection in the data fields.

    7. To design a mail merge template that lists out all the exported entries in a single document instead of creating one document per exported line of data choose the Mail Merge type to be “Directory”.


    After you insert the mail merge fields and click on preview, it would still display each record on a separate page. To check the results as a list in a document, complete the merge and export the merge to another document to see the entire list in a single document.

    Friday, August 28, 2009

    How to convert a RetrieveMultiple query written Server side to SOAP message to be used in Javascripts

    It has often been seen that a RetrieveMultiple query that is very easy to write using the server side Query Expression objects using CRM webservices becomes difficult to achieve if we need to create a SOAP message for the same.

    In this article we hope to explain each of the elements involved in the writing of SOAP messages to be used through Javascripts.

    Let us take a simple RetrieveMultiple code as an example.

    While writing the SOAP message the first component required is the SOAP envelope. This is the same at all times for all SOAP messages.

    "<?xml version='1.0' encoding='utf-8'?>"+
    "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'"+
    " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"+
    " xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+

    Next we need to add the Authentication Header that needs to be passed along with the SOAP message for successful authentication with the CRM Web service. CRM has an inbuilt function GenerateAuthenticationHeader() that can be used for this purpose.

    var authenticationHeader = GenerateAuthenticationHeader();

    SOAP Body is where the actual SDK message to be executed is included.

    "<soap:Body>"+

    In our example we are using the RetrieveMultiple Message so we provide the Message name and the schema reference to the CRM webservices

    "<RetrieveMultiple xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>"+

    The parameter to a Retrieve Multiple Message is always a query expression

    QueryExpression query = new QueryExpression();

    "<query xmlns:q1='http://schemas.microsoft.com/crm/2006/Query'"+
    " xsi:type='q1:QueryExpression'>"+


    Now include all properties of the Query object that you set.

    Entity name

    query.EntityName = EntityName.incident.ToString();

    "<q1:EntityName>incident</q1:EntityName>"+

    Column Set

    query.ColumnSet = new AllColumns();

    "<q1:ColumnSet xsi:type='q1:ColumnSet'>"+
    "<q1:Attributes>"+
    "<q1:Attribute>title</q1:Attribute>"+
    "<q1:Attribute>incidentid</q1:Attribute>"+
    "</q1:Attributes>"+
    "</q1:ColumnSet>"+

    Criteria

    ConditionExpression condition = new ConditionExpression();
    condition.AttributeName = "title";
    condition.Operator = ConditionOperator.Like;
    condition.Values = new string [] {strSearchText};

    "<q1:Criteria>"+
    "<q1:FilterOperator>And</q1:FilterOperator>"+
    "<q1:Conditions>"+
    "<q1:Condition>"+
    "<q1:AttributeName>title</q1:AttributeName>"+
    "<q1:Operator>Like</q1:Operator>"+
    "<q1:Values>"+
    "<q1:Value xsi:type='xsd:string'>"+searchtext +"</q1:Value>"+
    "</q1:Values>"+
    "</q1:Condition>"+
    "</q1:Conditions>"+
    "</q1:Criteria>"+

    Here, we have used 'Like' condition operator, likewise one can use any of the sdk supported operators and change the values to be matched accordingly.


    Order by

    OrderExpression oe = new OrderExpression();
    oe.AttributeName = "title";
    oe.OrderType = OrderType.Ascending;
    query.Orders = new OrderExpression[]{oe};

    "<q1:Orders>" +
    "<q1:Order>" +
    "<q1:AttributeName>title</q1:AttributeName>" +
    "<q1:OrderType>Ascending</q1:OrderType>" +
    "</q1:Order>" +
    "</q1:Orders>" +

    Once you have set all of these… your SOAP message is ready for execution.

    Monday, August 24, 2009

    Converting ACT! Legacy data to Dynamics CRM

    There has always been a request for bringing in legacy data to Dynamics CRM before they migrate to you. One of the key points for going through with the shift from one system to another is the ability to have access to all the records in their legacy system in Dynamics CRM.

    The easy way out most often is to look for Data Export options from the current system to generic file formats like XML, CSV, XLS etc. Same is the case with ACT! as well. However though a quick and easy way out this does not necessarily guarantee the quality of the data migrated. Often not all data is exported from the ACT! System and sometimes the data exported is not in a format that can be easily imported to CRM.

    ACT! however has its own SDK made available that allows us to read every entity data from ACT! And this way we have more control over the data and format in which we want to bring it into CRM.

    Writing information to CRM is not a difficult task for a proficient Dynamics developer. With good knowledge of the SDK of both systems we have been able to successfully bring in not just the Account/Contact and basic details but also bring in Opportunities and history as well.

    A couple of tips that would help you when writing your own import tool for ACT!

    1. When importing activities, ACT! Allows you to store the activity description in rich text format. In CRM the activity details is a plain text attribute. So it is essential to make sure that all the RTF tags from the activity description read from ACT! are stripped off before writing the data to CRM.

    //read act history details to RTF

    RichTextBox rtf = new RichTextBox();

    rtf.Rtf = oHistory.Details;

    //Get the plain text desc from RTf to add to CRM

    Desc = rtf.Text

    2. When processing history be carefully while parsing the duration field of ACT! CRM requires duration to be specified in minutes.

    3. ACT! allows to associate Primary contact as well as additional Secondary contacts with a company. The main contact of ACT can be set as the primary contact in CRM and additional contacts can be made as Contacts by setting the Parent account of these correctly.

    4. ACT! provides for creating custom attributes and often you would want to bring to CRM as well. The custom attributes in ACT! are available just as any other field of ACT! and is not stored separately in a different entity.

    There are a number of migration tools available in the market to take care of ACT migration if you do not like to reinvent the wheel. One of the unique tools is available here with us, where we offer it as a service / product by testing with your data and verifying the details as well as making small changes according to your specific needs. Check this tool out here.

    Wednesday, August 19, 2009

    Maplytics for Dynamics CRM

    Further to our post on Maps integration for Dynamics CRM using Live Maps https://community.dynamics.com/blogs/crminogic/archive/2009/04/27/maps-integration-for-dynamics-crm-4.aspx we have been able to compile a list of mapping components that can be made available on different entities of CRM with the aim of enabling Geo analysis of the data stored in CRM.The entities covered are:
    1. Lead/Account/Contact – Plotting of the primary address of these on the map. It also provides the directions to the customer address starting from the organization address.

    2. Plotting of Accounts from a selected range of Accounts that come within the specified distance. The aim here it to be able to list out all accounts that are within a given range from the Starting point.

    3. Geo mapping of Leads/Accounts on the map with the aim to allow the users to analyze their customer based on geographical regions.

    4. Geo mapping of Sales/Opportunity on the map with the aim to allow the users to analyze their sales by geographical regions and thereby be able to design strategies focusing on a given region.
    Some of the features are:
    Ø Each of these when plotted on the map allow the users to drill down ability and also be able to open Contact/Lead/Account etc CRM form to check further details of these.

    Ø While searching for directions, you can specify the Route that you want to take and you would get the direction via the specified location.

    Ø View Summary or Detail information

    Ø Use of Advanced find view for providing the record selection to be plotted on the map.

    Preview:

    Here clicking on Get Direction one can see the following screen.

    Click here to check further details.

    Wednesday, July 29, 2009

    How to use Parameters in Workflows/Plugins

    CRM Plugins and Workflows provide the ability to pass external information to the plugins as well as receive information from plugin that can be used for further processing.

    Plugins:


    In case of Plugins, you can use the Secured Parameter and Unsecured Parameter that is available during Plugin registration to pass static information that can be used by the Plugin.
    It is better to use the unsecured parameter as this is available in offline as well.


    These parameters are available as parameters to the constructor of the Plugin.


    public class AccountCreateHandler: IPlugin
    {
    public AccountCreateHandler(string unsecure, string secure)
    {
    // Do something with the parameter strings.
    }
    public void Execute(IPluginExecutionContext context)
    {
    // Do something here.
    }
    }

    Workflows:

    Workflows are allow for Input as well as Output Parameters. You can use the Input Parameters to pass static information to the Workflows. The Output parameter feature of Workflow is very interesting. The Output parameter defined in the Workflow Plugin, becomes available in the CRM Workflow window. You can use this output parameter in any of the Workflow steps.
    It can be used in Wait/If condition block as a value to be checked for.




    It can also be used in Create/Update step. Here the Output parameter becomes available only for the attributes that match the parameter data type.



    If you had some complex logic to be evaluated before you decide who to assign the records to… you can create a Lookup type of Output parameter and assign the record to this.

    Monday, July 27, 2009

    Convert / Migrate Goldmine Email History and documents to Dynamics CRM

    We have noticed that a lot of Goldmine users are migrating to Dynamics CRM with the requirement to have the Goldmine History brought over in CRM.

    While it is very easy to get the Company/Contact information from Goldmine to CRM, one of the sore points is bringing in Email history to CRM. You will find all of the Pending/Open activities of Goldmine in the Cal table and the Closed activities in Conthist table.

    The Cal/Conthist table stores all the details of the activity like the date/time, the type, the owner etc of the activity. The Ref field stores the subject and the Notes stores the description of the activity. This is true for all types of activities except Emails.

    In case of Email, the email body is stored not in the Notes of the Cal/Conthist but it is a separate table called “Mailbox” to store the email body. The RFC822 attribute of the Mailbox stores the actual content of the email body. “LinkRecid” is the attribute that will help you link the two tables.

    The data in this field includes the email in HTML and plain text format and requires to be processed before they can be added as the Email body in CRM. To start with it would be a good idea to use the Regular Expression class (RegEx) to parse out all HTML elements from the email body. This is essential as the email body in HTML format sometimes contains the Style tags and script tags which may cause a problem when taken to CRM and also it would not appear well formatted. It is always a good idea to parse out all HTML elements and take the email body as plain text in CRM.

    One more important point to remember is to parse out all newline characters like “\r” or “\n” from the email text. CRM email body accepts the message in HTML format so these can be replaced with the HTML newline tags like "<BR>".

    If you want to identify the contact to which the email was sent or any activity is associated with, you can check for the (oc: ) tag in the activity ref attribute. This tag contains the name of the secondary contact with which the activity is associated.

    Coming to email attachments. GM stores the physical file path in its table. During the migration process, you can look for the file at the given physical file path and write the attachment to CRM. This information can be found in the ContSupp table. So you can link the Conthist/Cal record with the ContSupp table to get the attachment file path.

    Hope this helps in conversion of Email history of Goldmine and shows you the intricacies involved in doing this through development.

    For those who would not like to reinvent the wheel there are a number of product migration utilities and services in the market by third party developers who can provide you with this already existing details including Inogic. Inogic has a unique way of approaching this migration where it has developed a migration tool for Goldmine that migrates Contacts/Pending/History/Emails/Attachments, Linked Documents to CRM and it provides this utility in a combination service by testing it with your Goldmine database and handholding you through your live migration and providing minor customization all at a FIXED COST to place your Goldmine data into Dynamics CRM.

    You can check out further details of this on our website.

    Monday, May 18, 2009

    Form assistant

    In CRM 3.0 there was no easy way to control the Form assistant window. We could get it done by making some changes to the customization file before importing into CRM.



    In CRM 4.0, we have now been given the option to decide the Form Assistant settings for each entity. You are most likely to miss it and I have seen many queries on this.

    To alter the Form assistant settings, follow the steps below:

    1) Go to Settings => Customizations => Customize the entity in our case it is Product
    2) Open product entity and go to Forms and views. Select the Form
    3) Here, go to Form Properties => Display tab




    Now, if both these checkboxes are checked you can see the form assistant open by default.

    If, you uncheck the “Expanded by Default” checkbox, then the form assistant will be there but will not be open up by default as shown in the screen below:




    Whereas, if you uncheck both the checkboxes i.e. “Expanded by Default” and “Enable form assistant”, then the form assistant will not be visible at all as shown in the screen below:


    It is important to publish the entity after any customization change is made to it.

    Tuesday, May 12, 2009

    Bulk Delete Operations for Dynamics CRM 4 On-Premise


    It is often that have you come across when you wanted to delete records from CRM in bulk.

    The only option you have to delete multiple records in CRM is by selecting all records available in one page of a view and then hit delete. A view can have at max 250 records displayed. So if you need to delete more than that you have no choice but to navigate through each page and delete the records.

    Since we do a lot of conversion projects we need to delete previously imported records before running the conversion. And this was too much of a task...

    We started working on developing our own little project that will do the job. CRM has made available the BulkDeleteRequest Message in CRM SDK that allows us to delete more than one entity records at a time.

    The BulkDelete Message will create an asynchronous job that can be monitored through the System Jobs Menu option.

    You can provide the record selection criteria by specifying the query that needs to be executed to get the records over which the action needs to be performed.

    If you want this to a recurring job to be executed say every x days, you can set the RecurrencePatern of the BulkDeleteRequest Message.

    Since the bulk delete operation can be run on any entity and it requires a query to be provided, we thought of generalizing this. We developed a small tool that allows the users to specify the parameters for the Bulk Delete Job in user friendly interface. These jobs can be monitored in the system jobs window.

    Anyone who would like to get this tool without having to re-invent the wheel can check details at http://www.inogic.com/addons_bulk_delete.htm

    Thursday, April 30, 2009

    CS0433 Error in Dynamics CRM and its resolution

    To incorporate a custom .NET application in Dynamics CRM, you are required to copy the custom forms to ISV folder and the compiled library to the bin folder. Sometimes it may so happen that after you have copied the dll to the bin folder and refresh CRM, it would just not load. One small custom application has brought down your CRM.

    If you enable DevErrors in the web.config file, you would see a screen similar to this when you open CRM.



    Cause: When developing the custom application, the project had a Global.asax added to it. When you compiled the project into a DLL the global.asax class was included in the compiled library. CRM 4.0 only requires a single Global.asax file and it has already included that in its own libraries.

    Resolution: You need to remove the Global.asax from your project and compile it again. Put the revised dll in the bin folder and your CRM and the custom application is up and running.

    Wednesday, April 15, 2009

    Import Price Lists in Dynamics CRM


    CRM 3.0 provided limited support for importing data from external files. We were only allowed to import data of few entities like Account, Contact, Lead etc.

    This feature has been greatly enhanced in version 4.0. The import tool now allows to import data into most of the entities. It also allows for Mapping of attribute values especially for Picklist type of attributes.

    One of the shortcomings though is that it doesn’t update existing records. It will always create new records from the import file. The work around for this would be to develop your own custom application using CRM SDK.

    We found that companies receive Price Lists from their vendors on a regular basis and they were required to import and update the prices in CRM for the Products. Since the Import tool would not work in this scenario we had to develop an import tool.

    Using SDK we create/update Price List Items (the entity that stores the prices). Price Lists Items are created as a unique combination of Product/Unit and Price List. A change in either of these 3 attributes will result in a new Price List Item record.

    Once we were able to create/update Price List Item, we extended it further to take care of scenarios where the Product itself does not exist in CRM. In this case to import the price we were required to first create the Product in CRM and then create a Price List Item for that product. Note that Product entity has few of its attributes mandatory so you need to take care of this in the External file so that the product can be created successfully.

    With a successful implementation of this, we went a step further to generalize this tool so that the tool could be used to import and set the values for any of the attributes of Product or Price List Item. This was not too difficult. The only requirement was that the column name in the external file should match the attribute's schema name in the Product or Price List Item entity. With this requirement satisfied you can now set the values for custom attributes on your product entity.

    Any SDK developer with good knowledge of Dynamics CRM can take the above route and validation to develop an Import tool for repetitively importing product price list in CRM. For those who do not want to reinvent the wheel, you can contact us or any other third party developers who must have developed this product already. More information at

    http://www.inogic.com/addons_price_list.htm

    Thursday, April 9, 2009

    Edit CRM Messages

    Its quite often that we need to change the default nomenclature of CRM to customer specific normal like renaming Account to Customer, Lead to Prospect and so on.

    When you change the entity name the name is reflected on most places. However in the messages and other related functionality of CRM it still reflects the old name so for e.g. even though you have changed the entity name of Lead to Prospect it would still show “Convert Lead…” on the button.



    To change such labels and other related messages that CRM displays related to this entity it is important that will also change the Messages section of the entity.

    You can follow the steps below:

    1. Go to Settings => Customization
    2. Edit the Lead Entity
    3. Choose the Messages navigation option.You will find a list of all messages displayed/used by CRM for this entity.




    4. Edit the message as required and save and Publish the entity to see the changes.

    Thursday, March 12, 2009

    New Plugin Messages made available by Microsoft in Dynamics CRM 4.0

    Execute: The execute event always gets fired when you open the views. Like from Main application view, lookup view, Advanced search view etc. (but not from associated views).
    While registering this event, no primary entity name is required.
    Input parameter: fetchxml - The fetchXML query sent.
    Output parameter: fetchxmlresult - The resultant records of the fetchXML query

    Retrieve: The event is available for each of the entities like account, contact, custom entities etc. When user opens CRM record (CRM form) this event is fired
    Input parameter: columnset - the attributes requested in the Retrieve Message
    Output parameter: businessentity - The resultant business entity found.

    Retrieve Multiple: The event will fire when user goes to associated view of Contacts or Custom entities that do not use the Rollup message. So it works for all associated views that does not provide the “Related Regarding Records” option.
    Input parameter: query - Query passed to the Retrieve Multiple message
    Output parameter: businessentitycollection - The resultset business entity collection.

    Rollup message can be used for associated views that provide the option of displaying related records. However the Plugin registration tool does not provide for registering on the Rollup message. So that is something we still need to find out how it works.

    Route: Route event gets fired when any of below entity instance moves from one queue to another.
    Appointment
    CampaignActivity
    CampaignResponse
    Email
    Fax
    Incident
    Letter
    PhoneCall
    ServiceAppointment
    Task

    For email entity new events introduced are,
    Assign, BackgroundSend, CheckIncoming, CheckPromote, Create, Delete, DeliverIncoming, DeliverPromote, DetachFromQueue, GrantAccess, Handle, ModifyAccess, Retrieve, RetrieveMultiple, RetrievePrincipalAccess, RetrieveSharedPrincipalsAndAccess, RevokeAccess, Route, Send, SendFromTemplate, SetState, SetStateDynamicEntity, Update

    So with Dynamics CRM 4.0 Microsoft has given greater control to the developers to trap appropriate messages and perform custom actions.

    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.

    Wednesday, February 25, 2009

    Add SRS report to CRM Form

    In course of implementation of Dynamics CRM, a number of clients have asked us to display reports designed using Sql Reporting Services (SRS) within CRM as a tab or may be as a option to the Main Menu. This helps the user to quickly check reporting. I have described a simple way to achieve this in Dynamics CRM
    This can be done using following steps.
    - Create SRS report.
    - Get the rdl file from the project.
    - Open IE and type
    http://servername/reports without port number as shown below



    - Click on “Upload File” each time for each of the “.rdl” files which we are sending you with this mail and then click OK.
    - Do not change its “Name” attribute, as shown below.


    - Open IE and type
    http://servername/reportserver without port number
    - Here you will find the report with the same name as of above.
    - Click on the page which will open the report in IE.


    - Copy this url and use where ever you want i.e. in IFrame or aspx page which would look like:

    "http://servername/reportserver?%2fcrmorg1_MSCRM%TestReport&rs:Command=Render"
    - Just pass this url and you can see the reports.

    You can also append "&rc:Toolbar=false" to the above url if you dont want the toolbar to be seen in the reports(refer the above image below the address bar) and "&rs:ClearSession=true" to ensure that everytime you can see fresh reports.So that the modified url will look like:

    "http://servername/reportserver?%2fcrmorg1_MSCRM%TestReport&rs:Command=Render&rc:Toolbar=false&rs:ClearSession=true">

    With this you can now design a dashboard report in CRM and have it added as item under Workplace and set it as the Default item to be displayed. So each time you login you see the dashboard.

    Wednesday, February 11, 2009

    Product/Inventory Kits in Dynamics CRM and its utilization

    Dynamics CRM provides for setting up of "Kits". Kits are basically a group of items that are sold together always. Just like you can associate substitute items with a product, it is possible to associate all products that make up the Kit. The "Kit Products" option is only available for "Kit" type of items.

    While this is not directly made available as a type of product like "Sales
    Inventory", "Services" etc, it can be found as an option under More Actions
    --> Convert to Kit


    Once a product is converted to Kit it is possible to convert it back to "Product". A similar option as above called "Convert to Product" is available for Kit Products.

    The Kit product is available just as any other product for selection in Opportunities/Quotes/Orders/Products.



    One feature though missing and would truly help was if there was a way to determine the price of the Kit based on the price of its components. And if it were possible to explode the kit and have the individual components listed on the Quote (if someone needed to list out the components being supplied in the kit).

    To overcome the above shortcoming of updating the price of the Kit based on the price of its components we proposed the following solution to one of our clients.

    1. Write a Post-Update plugin on the Price List Item entity.
    2. The plugin would read the Product, Unit and Price List from the Price list item.
    3. With the Product and Price List in hand, search if this Product is a part of kit and if so, re-calculate the price of the Parent Kit product.


    The following messages of the SDK would be helpful when dealing with Kits
    * ConvertKitToProductRequest
    * ConvertProductToKitRequest
    * AddProductToKitRequest
    * RemoveProductFromKitRequest


    FilteredProductAssociation is the view that stores the list of Products that belong to a kit. There is no entity available called ProductAssociation that you can make an object of directly. But using link entity in query expression and linking it to ProductAssociation would work.

    Monday, February 9, 2009

    Microsoft Office Accounting Integration Link with Microsoft Dynamics CRM released which supports Dynamics CRM version 4.0 On-Premise/CRM Live

    Microsoft Office Accounting is one of the most popular accounting packages from Microsoft for small and medium industry. Dynamics CRM is one of the most popular CRM systems being deployed by Microsoft consultants. Linking the two applications has been a crying need for resellers, prospects and end users of Dynamics CRM system.

    To bridge the gap for the users, we have come up with a link which has the following features:

    Customer Synchronization: Accounts of Dynamics CRM and Customers of Office Accounting are completely synchronized. You can save an Account in Dynamics CRM and promote it to Office Accounting. Vice versa, you can synchronize customers from Office Accounting applications to view and edit it in Dynamics CRM. Any edit and update on the Dynamics CRM side reflects in Office Accounting in the real time.

    Invoices and Orders Viewing in Dynamics CRM:
    Complete view of a particular customers Invoice and Orders history in Dynamics CRM within its tabs.

    Promote Orders from Dynamics CRM:
    This feature is extremely useful for Sales people to make Orders against opportunities in CRM and then promote it to Office Accounting for further processing.

    Quick Customer Account Information: Various financial important data like Credit Limit, Aging, and Terms etc from the Office Accounting is available against the Dynamics CRM customer for viewing of Sales People.

    Versions supported:
    Microsoft Office Accounting: US Edition – 2008/2009/2010/2011, UK Edition - 2008/2009/2010

    Microsoft Dynamics CRM: 4.0 On-premise and CRM Live.

    Download White Paper