Tuesday, April 28, 2009

Retrieve Multiple Dynamic Entity Records Example


BusinessEntityCollection retrieved = RetreiveMultipleEntityDetails(entityName.Trim().ToLower(), new string[] { filterColumn }, new string[] { filterValue }, null);            if (retrieved != null)                  return (DynamicEntity)retrieved.BusinessEntities[0];            return null;      }
public BusinessEntityCollection RetreiveMultipleEntityDetails(string entityName, string[] filterColumns, string[] filterValues, string[] ColumnList)        
RetrieveMultipleResponse retrieved = new RetrieveMultipleResponse();
/// Create the query object.
QueryByAttribute query = new QueryByAttribute();
query.EntityName = entityName.Trim().ToLower();
if (ColumnList == null)
query.ColumnSet = new AllColumns();
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.