Monday 23 June 2014

Using Query Expression

QueryExpression query1 = new QueryExpression()
                    {
                        EntityName = "prefix_entityname",
                        ColumnSet = new ColumnSet(true),
                        LinkEntities = {
                            new LinkEntity
                            {
                                JoinOperator = JoinOperator.Natural,
                                LinkFromEntityName = "prefix_entityname",
                                LinkFromAttributeName = "prefix_entitynameid",
                                LinkToEntityName = "prefix_entityname2",
                                LinkToAttributeName = "prefix_entitynameid",
                                LinkCriteria = new FilterExpression
                                {
                                    FilterOperator = LogicalOperator.And,
                                    Conditions  =
                                    {
                                        new ConditionExpression
                                        {
                                            AttributeName = "prefix_entityname2id",
                                            Operator = ConditionOperator.Equal,
                                            Values =  {
                                                entity2id
                                            }
                                        },
                                        new ConditionExpression
                                        {
                                         AttributeName = "prefix_entity2attribute2",
                                         Operator = ConditionOperator.Equal,
                                         Values = {
                                         attribute2value
                                         }
                                        }
                                    }
                                }
                            }
                        }
                    };

Tuesday 17 June 2014

Query execution time of xxxx seconds exceeded the threshold of 10 seconds

When tring to delete one of the custom entity I was getting failure in deletion and when looked into the event view I saw the message

Query execution time of 30.0 seconds exceeded the threshold of 10 seconds


After a quick google I found the value of threshold is stored in the ServerSettingProperties table of MSCRM_Config database, I used following queue to update the value

use mscrm_config

update serversettingsproperties
set intcolumn = 25
where columnname = 'longQueryThresholdInSeconds'


http://community.dynamics.com/crm/f/117/t/64580.aspx