Thursday, February 12, 2009

Report Scheduler Tool

Jonw wrote this on his blog


I created a tool using Visual Studio and the CRM web services that can execute a saved query and then email the results as a CSV file. I've presented in a video at www.democrmonline.com/reportscheduler.

There is also sample code at Report Scheduler Sample Code.

With a small change, this tool could be used with the Windows scheduler to run automatically. I left this out intentionally since this code is NOT supported and is as is.

At the least, it's quick start if you wanted to build your own.

-cheers
Jonw

Convergence 2009 – March 10-13, 2009 | New Orleans, LA

 

Discover the Power of Possibilities at Convergence and gain your competitive edge.
In today’s difficult economic environment, there has never been more value in attending Convergence. This year is geared toward helping you leverage your Microsoft Dynamics solutions to increase visibility into operations and maximize efficiencies. You will gain exposure into new technologies, better understand your current business management software, and gather insights you need to unleash your current solution’s full capabilities. Attend Convergence and learn how to:

  • Easily analyze your financial data and respond to changing business conditions.

  • Effectively forecast and manage your cash flow and compliance with clear understanding of reporting and process automation capabilities.

  • Access your comprehensive client information and stay connected to the needs of your customers.

  • Leverage your implementation with related applications like SQL Server and the Microsoft Office products which are an integral part of an integrated Microsoft Dynamics business solution

  • Improve fiscal responsibility and the delivery of public services.

  • Boost efficiencies and improve accountability with accurate financial tracking and reporting

Click here to learn more about Convergence New Orleans and how to get registered!

Convergence 2009 – March 10-13, 2009 | New Orleans, LA

 

Discover the Power of Possibilities at Convergence and gain your competitive edge.
In today’s difficult economic environment, there has never been more value in attending Convergence. This year is geared toward helping you leverage your Microsoft Dynamics solutions to increase visibility into operations and maximize efficiencies. You will gain exposure into new technologies, better understand your current business management software, and gather insights you need to unleash your current solution’s full capabilities. Attend Convergence and learn how to:

  • Easily analyze your financial data and respond to changing business conditions.

  • Effectively forecast and manage your cash flow and compliance with clear understanding of reporting and process automation capabilities.

  • Access your comprehensive client information and stay connected to the needs of your customers.

  • Leverage your implementation with related applications like SQL Server and the Microsoft Office products which are an integral part of an integrated Microsoft Dynamics business solution

  • Improve fiscal responsibility and the delivery of public services.

  • Boost efficiencies and improve accountability with accurate financial tracking and reporting

Click here to learn more about Convergence New Orleans and how to get registered!

Improving Microsoft Dynamics CRM Performance and Securing Data with Microsoft SQL Server 2008

Microsoft SQL Server® 2008 contains a variety of features that, when implemented properly, can improve the performance of a Microsoft Dynamics® CRM 4.0 implementation and secure the data within that deployment. These Microsoft SQL Server 2008 features include: - Compression - Filtered Indexes - Sparse Columns - Transparent Data Encryption - Backup Compression The MS CRM E2 team, working in conjunction with the Microsoft SQL Server team, recently completed a project that was designed to: 1. Evaluate the new scenarios that these Microsoft SQL Server 2008 features expose 2. Measure the performance impact of implementing these features, both singly and in selected combinations This paper provides an overview of these Microsoft SQL Server 2008 features, together with benchmark results and recommendations for implementation.

 

Click Here to Download

Adding A Filtered Lookup In CRM

by Danny Varghese 02.03.09


Another common question I see in blogs from users are is there a way to add filtered lookups? That is only allow users to "lookup" certain records that related to that particular one. Here's a real life example:

Say you have an account that has a 1:N parental relationship with entity A. Now let's say there's another entity B that has N:1 referential relationships with both account, and entity A. There is a way on entity B so that after you select, on the lookup, a record of the account you want to relate to it, to filter the second lookup of entity A to only those related to the account you just selected. i.e.

Parental Relationship

Account --> Entity A

Referential Relationship

Entity B -- Account

Entity B -- Entity A

With simple JavaScript, when a user selects the lookup value for the account, the lookup for Entity A can be filtered to point to only those entity A's that are related to the account you just chose. Here's the code to place on the form of Entity B:

crmForm.all.<lookup field for entity A>.additionalparams = 'search=' + encodeURIComponent(crmForm.all.<lookup field for account>.DataValue[0].name);

That's it! Simple, yet effective.

Example of Dynamic Entity Retrieval

by Danny Varghese 01.31.09


There have been numerous requests on other blogs about sample code to on how to retrieve entities in CRM. One way is to use the CRM web service to retrieve business entities, however by doing so, you're only limited to out-of-the-box entities with system attributes. To retrieve anything more "dynamic," you'll have to employ other methods.  Please remember that in order to retrieve any record, you must have the proper permissions on that entity.

Below is a code example of how to retrieve a record with an id using dynamic entity retrieve:

public DynamicEntity RetrieveEntity()


{


            //variable initialization     


            TargetRetrieveDynamic target = new TargetRetrieveDynamic();         


            RetrieveRequest retrieveRequest = new RetrieveRequest();            


            RetrieveResponse retrieveResponse = null;                                       


            DynamicEntity entity = null;                                      


 


            target.EntityName = <name of entity here>


            target.EntityId = <id of entity here>


 


            //initialize request parameters


            retrieveRequest.ColumnSet = new AllColumns();


            retrieveRequest.ReturnDynamicEntities = true;


            retrieveRequest.Target = target;


 


            //build the response object


            retrieveResponse = (RetrieveResponse)GetCrmService().Execute(retrieveRequest);


 


            //retrieve the service order item from the response


            entity = (DynamicEntity)retrieveResponse.BusinessEntity;


 


            return entity;


}


 




 



The above example is a simple one, but the example below retrieves all contacts that have an account id = some id, and also retrieve the records with only a certain attributes. This is probably a more robust example encompassing many retrieval options:



 





private ArrayList RetrieveMultipleContacts(ICrmService crmService, Guid parentAccountId)


{


    //variable initialization


    ConditionExpression condition = new ConditionBLOCKED EXPRESSION;


    FilterExpression filter = new FilterBLOCKED EXPRESSION;


    QueryExpression query = new QueryBLOCKED EXPRESSION;


    RetrieveMultipleRequest request = new RetrieveMultipleRequest();


    ColumnSet cols = new ColumnSet();


    RetrieveMultipleResponse response = null;


    ArrayList contacts = new ArrayList();


 


    //Set the condition for retrieval


    condition.AttributeName = "parentcustomerid";


    condition.Operator = ConditionOperator.Equal;


    condition.Values = new string[] { parentAccountId.ToString() };


 


     //Set the properties of the filter.


    filter.FilterOperator = LogicalOperator.And;


    filter.AddCondition(condition);


 


    //Set the attributes needed to be returned.  NOTE: The CRM Sdk has an erroneous example


    //of how to set the attributes for retrieval. 


    cols.Attributes.Add("address1_line1");


    cols.Attributes.Add("address1_line2");


    cols.Attributes.Add("address1_line3");


    cols.Attributes.Add("address1_city");


    cols.Attributes.Add("address1_stateorprovince");


    cols.Attributes.Add("address1_postalcode");


    cols.Attributes.Add("address1_country");


    cols.Attributes.Add("telephone1");


    cols.Attributes.Add("fax");


 


    //Set the properties of the QueryExpression object.


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


    query.ColumnSet = cols;


    query.Criteria = filter;


 


    //Set the query for the request and set the flag to return


    //dynamic entities


    request.Query = query;


 


    //retrieve the contacts


    response = (RetrieveMultipleResponse)crmService.Execute(request);


    foreach (BusinessEntity cont in response.BusinessEntityCollection.BusinessEntities)


    {


        contacts.Add(cont);


    }


 


    return contacts;


}



I hope these examples help someone, happy coding!

Open vs. Scheduled Appointments In CRM

by Danny Varghese 01.23.09


In CRM, when creating appointments, you can set the status to Open or Scheduled.  But why would a user set the status to one or the other?

According to the SDK, the status and state codes are different:

For CRM Outlook users, the only real difference seems to be the scheduling. When other users look at your calendar during this time period, if the appointment was marked Open, the time block will be marked as "tentative." If the appointment was marked Scheduled, the time will show up as "busy" in Outlook.