Friday, February 6, 2009

Microsoft CRM 4.0 Part - II

ISV (Independent Software Vendor):
These are companies which either makes software or sell software products, Microsoft CRM provides complete customization kit and SDK for ISVs to build and customize the CRM package according to the requirements of a client. Also ISV themselves can have a CRM server and host multiple organizations for different clients on one CRM server; this is a new feature of multi tenant in CRM 4.

ISV Configuration:
How ISV will add its custom components to the CRM? In previous version there was an XML file named “ISV.config” available for ISV to add custom components, the file was located on CRM server in “<web>\_Resources” folder, whereas in CRM 4 the same file is used but this time it is saved in database rather than file system, why it has been stored in database? We will see that next. The “ISV.config” file is used to customize following:

1. Area labels in left navigation pane in forms
2. Main global menu
3. Goto and Help menu
4. Application level toolbar
5. Custom menu on CRM entities

“ISV.config file is different for each organization”

Why ISV.Config stored in database?
As we know that CRM 4 has been introduced with multi tenant feature, if we save the ISV.config file in file system it would be difficult to manage config files of different tenants in file system, in CRM 4 a separate database catalog is created for each organization, that is why all customization configuration files are also stored inside database, we have another file of site map as well which is used to customize application navigation.

In this file we can define different menu options and also configure which menu its is shown on which client, we have three clients for CRM “Web”, “Outlook” and “Outlook offline”; therefore we can show one menu item on Web but not in outlook, etc

Customize ISV.Config or SiteMap.xml using CRM XML Editor:
This is another tool from Patrick; this program can simplify the process of editing and publishing the “ISV.config” and “SiteMap.xml”, this is a one window operation and can prove to be useful in customizing these areas quickly

Reference:http://www.patrickverbeeten.com/pages/TechnicalNet/MicrosoftCrm/CrmXmlEditor.aspx?id=20

How to customize ISV.Config or SiteMap.xml?
The CRM way is to export the ISV.config file from CRM, modify that and import into CRM, for this we will use web client to connect with CRM and do as follows:

1. Open CRM site and select “Settings”
2. Select “Customization” and click “Export customization”
3. From the view dropdown select “Client Extensions”
4. This will list two configuration files “ISV.config” and “SiteMap.xml”
5. Select “ISV.config” and click “Export selected customizations”, a information dialog is shown click OK to continue
6. A file download dialog is shown, click “Save”, and locate the location where to save this file, a (customization. zip) is created
7. Unzip this file will give “customization.xml”
8. Now customize this file and when done use import feature to publish these changes to CRM

What is “customization.xml”?
This is a way of exporting all customizations from CRM and is than used to deploy them on another CRM server or organization, this single configuration file have hold all customizations of CRM from entities, forms, to ISV.config, SiteMap.xml, that is all customizations.

How to enable the ISV.Config?
By default the customizations of this file are not visible, administrator will have enable them himself so these customizations will appear on the forms and navigation areas. This is done as follows:

1. Open CRM site using web client
2. Select “Settings” and click “Administration”
3. Here you will find “System settings”, click that to open in another window
4. Now select “Customization” tab, here you will see area for ISV, click the ellipsis (…) button
5. This will show list of clients for which the ISV.config customization is visible, we have three options here “Outlook”, “Outlook offline”, “Web Application”
6. We select “Web Application” for this time and click OK, now reload your page to view customized menus

Passing Parameters to a URL using ISV.Config:

There are two ways to pass parameters to a URL using ISV.Config.
1. Use the PassParams attribute.
2. Use a querystring parameter within the URL.

Passing parameters to the target URL using the PassParams attribute provides information to the target application about the context of the record . All the parameters are passed if the Button element, the MenuItem element, or the NavBarItem element is configured by using the PassParams attribute.

You can indicate whether a Button, MenuItem, or NavBarItem passes the parameters listed in the following table.

TypeEntity Type CodeAn integer that uniquely identifies the entity.
idObject GUIDThe GUID that represents a record.
orgnameOrganization NameThe unique name of the organization.
userlcidUser Language CodeThe language code identifier that is used by the current user.
orglcidOrganization Language CodeThe language code identifier that represents the base language for the organization.

Language codes are a four digit Locale ID. Valid Locale ID values can be found at http://msdn2.microsoft.com/en-us/library/0h88fahh.aspx.

Example:
Without parameters:
http://myserver/mypage.aspx

With parameters:
http://myserver/mypage.aspx?orgname=AdventureWorksCycle&userlcid=1033&orglcid=1033&type=1&typename=account&id=%7BDBD5DBFB-0666-DC11-A5D9-0003FF9CE217%7D

Use a QueryString parameter within the URL:
You can include a QueryString parameter within the URL attribute. This can be particularly useful if you want the Button, MenuItem, or NavBarItem to open a specific Microsoft Dynamics CRM record or view using URL Addressable Forms and Views.

Note:
1. It is best to use the entity name instead of the entity type code because the entity type code may be different between Microsoft Dynamics CRM installations.
2. You will not be able to import the ISV.Config if the URL includes the ampersand (&) character used to separate multiple QueryString parameters in the URL. This character makes the XML invalid. You must escape the ampersand character in the URL attribute value with "&".

Reading Passed Parameters:
Passed parameters are usually read in the target (.aspx) page by using the HttpRequest.QueryString property.

PrependOrgName Function:
Prepends the organization name to the specified path,

Usage: prependOrgName (sPath)

Parameters: sPath
A String that contains a relative URL to a custom aspx page in the ISV folder of the Microsoft Dynamics CRM Web site

Returns: A String that contains the complete URL

Remarks: The string that is returned uses the following format:
var url = "/"+ORG_UNIQUE_NAME+sPath;

Example: var url = prependOrgName("/isv/app/myapp.aspx");

Automating CRM Invoice:
We have a client which needs an automated feature of making invoice out of quote. The user will enter a quote and an invoice is generated automatically

First we should know the process of how a quote will become an invoice; following are the stages between a quote and an invoice:

1. A new quote is created and is activated, its status is changed to active
2. Now we can “Revise” the quote or “Close the quote”
3. If a quote is Activated, it cannot be changed or modified, to modify a quote we will have to change its status to revise
4. Once revision is done the quote is activated again
5. Orders can be generated for a quote when a quote is activated, if a quote is closed no orders can be generated for it
6. If we need to reuse a closed quote, we will have to revise it and activate again
7. Now next step is to create an order, before we can create an order we have to set the status to “won”, this indicates we have won the quote and now we are issuing an order
8. Now once the quote has been turned into order, it will no longer be visible in active quotes view,
9. The next step after generating an order is to either cancel an order or fulfill the order
10. If we cancel the order, we set the status to “No Money”, the order cannot not be activated again now, we will have to open the quote again and generate an order, of course we will again revise the quote and activate it
11. When ever a quote is revised another copy of the same quote is created and the original quote remains preserved in the system and the new quote gets a revision number which is a incremented number
12. Now we have again repeated previous steps to create a new order from the quote
13. Now if we select to “Fulfill” an order we can set following status, it is “Complete” or “Partial”, what ever status we set the next step will be to generate an invoice
14. Next we can either select “Cancel Invoice” or “Invoice Paid”
15. If we select “Invoice Paid” we will have to set either “Complete” or “Partial”
16. If we select “Cancel Invoice” we will have to set “Cancelled”

Quote to Invoice Cycle
Quote -> Activate -> Won or Quote -> Revise -> Activate -> Won
Than -> Order -> Fulfill (Complete or Partial) -> Invoice -> Paid (Complete or Partial)

We write a plug-in which on creation of a quote automates the process and generates the invoice. Our plug-in will work as follows:

1. Get the newly created quote by GUID
2. Create a SetStateQuoteRequest and set status of quote as “Active”
3. Create a WinQuoteRequest and set status of quote as “Won”
4. Create a ConvertQuoteToSalesOrderRequest and create new order from quote
5. Create a ConvertSalesOrderToInvoiceRequest and create new invoice from order
6. And this will conclude our goal

No comments:

Post a Comment