Tuesday, September 4, 2012

Reflection.

It's been almost 4 years since my last post. So much has changed since then... I'm no longer a CRM Developer. Once I became a Senior Dev for the world of CRM, I found myself hitting walls left and right. I'm now a Senior Web Developer and I enjoy it much more... I'm constantly challenged and I get to learn and grow everyday. To those who shared the same struggles and passion as I do... and find yourself the same position I was in 2 years ago... I'm happy to tell you the truth, CRM is only a niche. =)

Friday, November 21, 2008

Retrieve Dynamic Record

public DynamicEntity retrieveDynamicEntity(Guid entityID, string entityName)
{
try
{
TargetRetrieveDynamic targetRetrieve = new TargetRetrieveDynamic();

// Set the properties of the target.
targetRetrieve.EntityName = entityName;
targetRetrieve.EntityId = entityID;

// Create the request object.
RetrieveRequest retrieve = new RetrieveRequest();

// Set the properties of the request object.
retrieve.Target = targetRetrieve;
retrieve.ColumnSet = new AllColumns();

// Indicate that the BusinessEntity should be retrieved as a DynamicEntity.
retrieve.ReturnDynamicEntities = true;

// Execute the request.
RetrieveResponse retrieved = (RetrieveResponse)service.Execute(retrieve);

// Extract the DynamicEntity from the request.
DynamicEntity entity = (DynamicEntity)retrieved.BusinessEntity;
}
catch (Exception e)
{
return null;
}
}

Monday, November 10, 2008

CRM 4.0 - 3 of 9 Accelerators Released

http://www.codeplex.com/crmaccelerators/Release/ProjectReleases.aspx?ReleaseId=19132

I don't know how C360 will survive after these products...

Wednesday, October 29, 2008

CRM 3.0 Retrieve Workflow Process By Name

Just wanted to put this on the blog.  I used this snippet of code to retrieve the id of a wfprocess, and set the id to an instance of ExeWFProcessRequest for post create execution.  Of course doing this way, we have to ensure that the Workflows' names are unique to each other.


// Use a generic request to retrieve multiple records.
RetrieveMultipleRequest request = new RetrieveMultipleRequest ();

// Create the ConditionExpression object.
ConditionExpression nameCondition = new ConditionExpression();
ConditionExpression processTypeCondition = new ConditionExpression();
ConditionExpression stateCondition = new ConditionExpression();

// Set the condition to be the name equals workflowName.
nameCondition.AttributeName = "name";
nameCondition.Operator = ConditionOperator.Equal;
nameCondition.Values = new string [] {workflowName};

//specify a workflow process TAKE NOTICE
processTypeCondition.AttributeName = "processtypecode";
processTypeCondition.Operator = ConditionOperator.Equal;
processTypeCondition.Values = new string [] {"1"};

// Create the FilterExpression object.
FilterExpression filter = new FilterExpression();

// Set the filter's properties.
filter.FilterOperator = LogicalOperator.And;
filter.Conditions = new ConditionExpression[] {nameCondition, processTypeCondition};

// Create the QueryExpression object.
QueryExpression query = new QueryExpression();

// Set the QueryExpression object's properties.
query.EntityName = EntityName.wfprocess.ToString();
query.ColumnSet = new AllColumns();
query.Criteria = filter;

// Set the Request object's properties.
request.Query = query;

// Execute the request.
RetrieveMultipleResponse response = (RetrieveMultipleResponse) service.Execute(request);

// Get the results from the response.
BusinessEntityCollection entities = response.BusinessEntityCollection;

if(entities.BusinessEntities.Length == 1)
{
return ((wfprocess)(entities.BusinessEntities[0])).processid.Value.ToString();
}



Cheers,

Hong Tan
Microsoft Dynamics CRM Developer

Tuesday, October 28, 2008

Syntax error after upgrading Microsoft CRM 3.0 to 4.0

I know you dread it, especially when a client suggest that they are ready to upgrade from CRM 3.0 to 4.0.  You worry about the unforeseen issues, like this one...



Problem: After an upgrade for a client, I ran into an issue with syntax error.  It happens every time I close an account record, resulting a pop up similar to the image above .  Though I should have known better, simply removing the onLoad and onSave javascript will not do it.

Resolution:  You will need to also remove all the onChange javascript on all the attributes belonging to the entity form.  This will be especially cumbersome if your client has a large amount of attributes bound to a form that has onChange javascript. It is suggested that you export the customizations and remove/comment all of the javascript before/after the upgrade, then followed by an import.

Lastly, don't forget to use the C360 upgrade tool to remove all the ISV configurations on 3.0 before the upgrade if you do have any C360 add-ons that is.  You will run into issues if you don't do so.



Cheers,

Hong Tan
Microsoft Dynamics CRM Developer