Tuesday, April 28, 2009

Retrieve Multiple Dynamic Entity Records Example

Example:





try      
{
BusinessEntityCollection retrieved = RetreiveMultipleEntityDetails(entityName.Trim().ToLower(), new string[] { filterColumn }, new string[] { filterValue }, null);            if (retrieved != null)                  return (DynamicEntity)retrieved.BusinessEntities[0];            return null;      }
 
Function: 
 
 
 
public BusinessEntityCollection RetreiveMultipleEntityDetails(string entityName, string[] filterColumns, string[] filterValues, string[] ColumnList)        
{
RetrieveMultipleResponse retrieved = new RetrieveMultipleResponse();
try
{
/// Create the query object.
QueryByAttribute query = new QueryByAttribute();
query.EntityName = entityName.Trim().ToLower();
if (ColumnList == null)
{
query.ColumnSet = new AllColumns();
}
else
{
ColumnSet columns = new ColumnSet();
columns.Attributes = ColumnList;
query.ColumnSet = columns;
}
query.Attributes = filterColumns;
query.Values = filterValues;
RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
retrieve.Query = query;
retrieve.ReturnDynamicEntities = true;
 
retrieved = (RetrieveMultipleResponse)Service.Execute(retrieve);
if (retrieved != null)
return retrieved.BusinessEntityCollection;                return null;
}
#region Exception Handling
catch (System.Web.Services.Protocols.SoapException ex)
{
throw new Exception(ex.Detail.InnerText);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
#endregion Exception Handling
}

Friday, April 10, 2009

Get detailed error of Waiting Workflows


If an error occoured during the Workflow execution, and you want to see the detailed error of waiting workflow you just need to simply follow the below steps:

  • In the web client goto the 'System jobs' in the settings area
  • Click "Advanced find"
  • Click "Edit Columns"
  • Click "Add Columns"
  • Select the columns "Error Code" and "Message"
  • Click "OK" twice
  • Click "Find" this will execute the query and bring up the workflows which have executed. If the workflow ran into an error the error code and message column will contain details.

    Note that in case of an exception the message is the same as that logged in the trace files (if enabled)

You can save this query, this will make it available in the View list.


Thursday, March 26, 2009

Unable to Create / Update record for Business Closure.


First, you have to assign the below role (Update Business Closures) to the user.

Second, you have to assign another set of roles to the user:
Go to Service Management tab -> assign Calender entities (Create, Read, Write) roles.


Save and Close Roles record.
Refresh the Business Closures entity record page(http://SERVER:PORT/Organisation_Name/tools/business/business.aspx?pid=02)

Isn't it simple !!!!!

Wednesday, March 25, 2009

Declaration of Custom Workflow Input / Output Parameters


Eveyone struggle to declare the Custom workflow input / output parameters in the custom workflow activity. So here is the solution for it.

The following sample shows how to use each of the types found in Microsoft Dynamics CRM.

Input Parameter Declaration: (Click on the datatype to see the declaration)

Boolean


DateTime

Decimal

Float

Lookup

Money

Number

Picklist

Status

String


Output Parameter Declaration: (Click on the datatype to see the declaration)


Lookup


Hope this will help you in declaring the Custom workflow activity I/O parameters.

Global Javascript Functions in MS CRM 4.0


Global functions provide information about the client application and whether the user is working online.

The following table shows the available global functions.

IsOnline : Checks whether the client application for which this page is rendered is online or offline.

IsOutlookClient :Checks whether the form is shown on either Microsoft Dynamics CRM for Microsoft Office Outlook or Microsoft Dynamics CRM for Microsoft Office Outlook with Offline Access.

IsOutlookLaptopClient : Checks whether the form is shown on Microsoft Dynamics CRM for Outlook with Offline Access.

IsOutlookWorkstationClient : Checks whether the form is shown on Microsoft Dynamics CRM for Outlook.

GenerateAuthenticationHeader : Returns a string that represents a correctly formed Microsoft Dynamics CRM authentication header used when making Web service calls with Microsoft Dynamics CRM Web services.

PrependOrgName : Prepends the organization name to the specified path.