Quantcast
Channel: Microsoft Dynamics CRM
Viewing all 123975 articles
Browse latest View live

Forum Post: RE: Upgrading Visual Studio projects to use the new version of the CRM software developer toolkit

$
0
0
Hi Ben, Upgrade is always a good time to tidy things up. My advice - use this to remove Developer Toolkit, because it's a bad tool that leads to many problems. You just found one of it. It was not supported for so long that CRM Dev that were stuck with this could not even use Visual Studio 2015 (because last version of toolkit did not support VS 2015). I myself removed already Developer Toolkit from several projects because in the end it makes more trouble than help. Of course that's only my opinion, if you want to continue using this, you can but still you will have to rewrite the code to be compatible with the latest DT, why not spend that time to remove this tool? For managing plugins and WebResources much better solution are CRM Developer Extensions by Jason Lattimer

Forum Post: RE: "Customize the system" shows "An error has occurred" message.

$
0
0
Hi Guido, I am facing the same problem. Getting "error" from clicking "Customize the system". However, I am not sure what does your answer mean. Could you please indicate the solution? Thank you very much.

Forum Post: RE: Dynamic Marketing List Query

$
0
0
I assume list1 and list2 are static lists? And you are trying to create a third dynamics list based on these. The problem you have is that a is not equal will not work in the way you require. A dynamic list is effectively an advanced find. I think you will find that your query is not possible with a single advanced find. If you use a static list instead. You can then include members from list one. Then use manage members option to remove members from list 2. I think this will give you the results required. You can't use the remove option with a dynamic list, so I think you'll need to convert to a static list.

Forum Post: RE: Price listi tems

$
0
0
Thank you for your reply. Is it possible to select the price list in an entity and then a report to show the price list items Regards Dan

Blog Post: RetrieveMultiple Intro

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . When executing a RetrieveMultiple query, there are several factors that come into play to determine what query is executed. These factors are based primarily on entity record count, user security, and settings. Below is more information on RetrieveMultiple in general. Security Checks Security checks on RetrieveMultiple queries are broken down into three specific areas: · Records visible due to ownership · Records visible due to Business Unit access · Records visible due to sharing To put this into perspective, consider the following CRM query: Show me the first 50 Activity that I have access to see, sorted by the Scheduled End time. This may seem like a pretty simple request, but if the user making this request does not have global read access to contacts, the above security areas need to be considered before returning data. This is typically where a performance issue will occur. The following sections of this document will discuss the security settings that can be altered to improve performance. RetrieveMultiple Misconceptions Before getting into the settings that can be changed to help with the performance of RetrieveMultiple queries, I want to go through some of the most common misconceptions of RetrieveMultiple queries. Understanding these misconceptions will help ensure you do not go down the wrong path when troubleshooting a RetrieveMultiple performance issue. · When a RetrieveMultiple query is executing slowly, often the first conclusion drawn is to reduce the size of the PrincipalObjectAccess table. This is an incorrect assumption that can lead to a lot of unnecessary analysis of the PrincipalObjectAccess data. When the RetrieveMultiple settings are configured optimally for an organization, the PrincipalObjectAccess table size should not need to be reduced at all, regardless of how large it has grown. · Another incorrect assumption often made when investigating RetrieveMultiple performance issues is to set the EnableRetrieveMultipleOptimization setting to 2. This was a valid recommendation in CRM 2011 prior to UR10, but is no longer relevant. Further information on EnableRetrieveMultipleOptimization will be in an upcoming post in this series. · Another common misconception when tuning RetrieveMultiple queries is to simply run the query through Database Engine Tuning Advisory (DTA) and apply recommendations. Due to the nature of how security is added to the query, DTA is not going to provide relevant recommendations to resolve the problem. Other methods of tuning the query will be discussed in an upcoming post in this series. · Finally, another misconception with RetrieveMultiple queries is that increasing the timeout values will allow the query to complete. RetrieveMultiple has a hard-coded timeout value in the Deployment, thus the timeout registry keys will have no effect on this type of query. Next post in this blog series: RetrieveMultiple Administrator Query .

Forum Post: Record cannot be deleted because of an association

$
0
0
I get an error "The record could not be deleted because of an association" when I try to delete an Order. I'm not able to figure out where are the associations for the specific Order. Any help?

Blog Post: RetrieveMultiple Administrator Query

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . If you are a System Administrator, or have global access to the entity you are trying to query, the RetrieveMultiple statement does not need to take security into consideration. In this scenario, the query is very straight forward. Below is an example of this type of query for Activity records: select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from ActivityPointer as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = 1 )) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc Tuning the Admin Query One thing to keep in mind is that the basics of the above query are used in every RetrieveMultiple query, we simply inject the Security checks into it. Thus, if the admin query is not performing optimally, non-admins are going to see similar performance problems. Because of this, it is recommended to performance tune the admin query. While SQL, as well as the Database Engine Tuning Advisory (DTA), may not provide a recommendation here for indexing, we can create an index that will improve the performance of the query. The performance gain may not be immediately noticeable for admins if the query is already running fast, but once security is injected and more records need to be processed, the performance tuning done here will prove to be beneficial. Sample Index The following index can be added here to cover the above query. In my example test environment, this reduced the read count on ActivityPointerBase by 96%. create nonclustered index [ activityperftest ] on ActivityPointerBase ( ScheduledEnd , ActivityId , IsRegularActivity , OwnerId ) INCLUDE ( Subject , PriorityCode , Regardingobjectid , activitytypecode , statecode , scheduledstart , instancetypecode , regardingobjectidyominame , regardingobjecttypecode , regardingobjectidname ) The method used to develop this index is as follows. The indexed columns need to come from the Order By, Where, and Join items of the query, with the Order By coming first. This is how the indexed columns were determined. Next, any column in the view should be added as an Include column, unless it is already in the index as an indexed column. Next post in this blog series: EnableRetrieveMultipleOptimization .

Blog Post: EnableRetrieveMultipleOptimization

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . The primary setting that is used to determine how to handle the security considerations of a RetrieveMultiple query for non-admin users is EnableRetrieveMultipleOptimization (ERMO). The following are each of the applicable ERMO settings. Please note in that almost all cases, setting ERMO to 0 will be the best option. ERMO = 0 This should be the most commonly used setting for optimal performance. This setting allows you to take advantage of the various sub-settings that will be discussed in upcoming posts. We define this as the best setting to use when you have a wide variety of visibility counts between users, but in general it should be used in most situations. One example of a query when ERMO is set to 0 is below, but please note that this is not all inclusive since various sub-settings can further alter the query here. WITH "activitypointer0Security" as ( select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwnerId in ( SELECT id from dbo . fn_GetGuidsFromString ( @buIds0 )) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId00 and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwningBusinessUnit in ( @buId00 ) ) select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 )) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc ERMO = 1 This setting was considered the most optimal in CRM 4.0, as many of the additional settings we have today were not available. Today we recommend considering this setting when all users have access restricted to just the data they own, and do not have any associated shares. This would generally be a very uncommon scenario. An example of a query when ERMO is set to 1 is below: create table # ObjectsIds ( ObjectId uniqueidentifier ); create NONCLUSTERED index ndx_ObjectsIds_objId on # ObjectsIds ( ObjectId ASC ); insert into # ObjectsIds select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId0 and POA . ObjectTypeCode = @ ObjectTypeCode and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ; insert into # ObjectsIds select ActivityId from [ ActivityPointer ] WITH ( NOLOCK ) where OwnerId in ( select pem . PrincipalId from PrincipalEntityMap pem WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on pem . PrincipalId = sup . PrincipalId where sup . SystemUserId = @UserIdOwnerCommand0 and pem . ObjectTypeCode = @OtcOwnerCommand0 ) insert into # ObjectsIds select ActivityId from [ ActivityPointer ] WITH ( NOLOCK ) where owningbusinessunit in ( select BusinessUnitId from SystemUserBusinessUnitEntityMap WITH ( NOLOCK ) where SystemUserId = @ SystemUserId and ObjectTypeCode = @ ObjectTypeCode ) select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from ActivityPointer as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 ) and ( "activitypointer0" . ActivityId in ( select distinct ObjectId from # ObjectsIds ))) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc ; drop table # ObjectsIds ERMO = 2 This was considered the optimal setting in CRM 2011 pre-UR10. This setting would be considered today when all users have visibility to a large amount of records, while being associated with a very small amount of Principals and Business Units. This would be another edge scenario. An example of a query when ERMO is set to 2 is below: select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from ActivityPointer as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 ) and ( "activitypointer0" . OwnerId in ( SELECT id from dbo . fn_GetGuidsFromString ( @buIds0 )) or "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) where POA . PrincipalId in ( @userPrincipalPOA00 , @userPrincipalTeamPOA00 , @userPrincipalTeamPOA1100 , @userPrincipalTeamPOA2100 , userPrincipalTeamPOA3100 , @userPrincipalTeamPOA4100 , @userPrincipalTeamPOA538 , @userPrincipalTeamPOA610 , @userPrincipalTeamPOA710 , @userPrincipalTeamPOA810 , @userPrincipalTeamPOA910 , @userPrincipalTeamPOA1010 , @userPrincipalTeamPOA1110 , @userPrincipalTeamPOA1210 , @userPrincipalTeamPOA1310 , @userPrincipalTeamPOA1410 , @userPrincipalTeamPOA1510 , @userPrincipalTeamPOA1610 , etc . etc .) and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) or "activitypointer0" . OwningBusinessUnit in ( @buId00 ) )) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc ERMO = 3 This is a rarely used, and scarcely documented setting that is generally meant to be implemented only for performance and functional comparisons. It would be considered optimal in environments where SQL memory is concerning, and all table row counts are small. An example of a query when ERMO is set to 3 is below: select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from ActivityPointer as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 ) and ( "activitypointer0" . OwnerId in ( select pem . PrincipalId from PrincipalEntityMap pem WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on pem . PrincipalId = sup . PrincipalId where sup . SystemUserId = @UserIdOwnerCommand00 and pem . ObjectTypeCode = @OtcOwnerCommand00 ) or "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId00 and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) or "activitypointer0" . OwningBusinessUnit in ( select BusinessUnitId from SystemUserBusinessUnitEntityMap WITH ( NOLOCK ) where SystemUserId = @SystemUserId0 and ObjectTypeCode = @ObjectTypeCode1 ))) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc Next post in this blog series: RecordCountLimitToSwitchToCteSecuritySql .

Blog Post: RecordCountLimitToSwitchToCteSecuritySql

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . This setting is what is used to determine at which point a CTE query should be executed for RetrieveMultiple . The default value for this setting is 75,000, and can be modified via OrgDbOrgSettings . If the entity’s record count is above the value for this setting, a CTE query will be executed. If the entity’s record count is below the value for this setting, an OR-based query using joins will be used instead. The entity’s record count is determined by retrieving the value from the RecordCountSnapshot table. This table is updated daily by Maintenance Job 45 ( RefreshRowCountSnapshots ). A helpful query that can be manually executed to review the Record Count sizes of every entity is below: select a . count , b . name from RecordCountSnapshot a join entity b on a . objecttypecode = b . ObjectTypeCode order by a . count desc Query examples of what you can expect to see from a CTE query and an or-based join query are below: CTE Query WITH "activitypointer0Security" as ( select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwnerId in ( SELECT id from dbo . fn_GetGuidsFromString ( @buIds0 )) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId00 and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwningBusinessUnit in ( @buId00 ) ) select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 )) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc OR-Based Query Using Joins exec sp_executesql N'select top 51 "activitypointer0".Subject as "subject" , "activitypointer0".PriorityCode as " prioritycode " , "activitypointer0".RegardingObjectId as " regardingobjectid " , "activitypointer0".ActivityTypeCode as " activitytypecode " , "activitypointer0".StateCode as " statecode " , "activitypointer0".ScheduledStart as " scheduledstart " , "activitypointer0".ScheduledEnd as " scheduledend " , "activitypointer0".InstanceTypeCode as " instancetypecode " , "activitypointer0".ActivityId as " activityid " , "activitypointer0".RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0".RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0".RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid".InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from ActivityPointer as "activitypointer0" WITH (NOLOCK) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH (NOLOCK) on ("activitypointer0".OwningUser = " activitypointerowningusersystemusersystemuserid ". SystemUserId ) where (("activitypointer0".IsRegularActivity = @IsRegularActivity0) and ("activitypointer0".OwnerId in (select pem.PrincipalId from PrincipalEntityMap pem WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on pem.PrincipalId = sup.PrincipalId where sup.SystemUserId = @UserIdOwnerCommand00 and pem.ObjectTypeCode = @OtcOwnerCommand00) or "activitypointer0".ActivityId in (select POA.ObjectId from PrincipalObjectAccess POA WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on POA.PrincipalId = sup.PrincipalId where sup.SystemUserId = @SystemUserId00 and POA.ObjectTypeCode = @ObjectTypeCode0 and (( POA.AccessRightsMask|POA.InheritedAccessRightsMask ) & 1) = 1) or "activitypointer0".OwningBusinessUnit in (select BusinessUnitId from SystemUserBusinessUnitEntityMap WITH (NOLOCK) where SystemUserId = @SystemUserId0 and ObjectTypeCode = @ObjectTypeCode1))) order by "activitypointer0".ScheduledEnd asc , "activitypointer0".ActivityId asc' , N'@IsRegularActivity0 bit,@UserIdOwnerCommand00 uniqueidentifier,@OtcOwnerCommand00 int,@SystemUserId00 uniqueidentifier,@ObjectTypeCode0 int,@SystemUserId0 uniqueidentifier,@ObjectTypeCode1 int' , @IsRegularActivity0 = 1 , @UserIdOwnerCommand00 = '10762A09-58F6-E311-B866-6C3BE5A80FD8' , @OtcOwnerCommand00 = 4200 , @SystemUserId00 = '10762A09-58F6-E311-B866-6C3BE5A80FD8' , @ObjectTypeCode0 = 4200 , @SystemUserId0 = '10762A09-58F6-E311-B866-6C3BE5A80FD8' , @ObjectTypeCode1 = 4200 Next post in this blog series: Sharing Considerations .

Blog Post: Sharing Considerations

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . The RetrieveMultipleSharingCountThreshold setting is what we use to determine at which point we should utilize a Table Valued Function (TVF) to calculate sharing. The default value for this setting is 1000, and can be modified via OrgDbOrgSettings . If the user’s share count is below the value for this setting, we will use TVF to calculate sharing. A user’s share count is determined by retrieving the value from the PrincipalObjectAccessReadSnapshot table. The user’s share count is broken down by entity in this table. The table is updated daily by Maintenance Job 46 ( RefreshReadSharingSnapshots ). A helpful query that can be manually executed to review the Record Count sizes for every user and every entity is below: select b . FullName , a . Count , c . Name as EntityName from PrincipalObjectAccessReadSnapshot a join systemuserbase b on a . principalid = b . systemuserid join entity c on a . ObjectTypeCode = c . ObjectTypeCode order by b . FullName asc , a . Count desc Query examples are below, with the highlighted portion illustrating the differences based on which setting is used: Query Below RetreiveMultipleSharingCountThreshold Value exec sp_executesql N'WITH "activitypointer0Security" as ( select Subject as "Subject", PriorityCode as " PriorityCode ", RegardingObjectId as " RegardingObjectId ", ActivityTypeCode as " ActivityTypeCode ", StateCode as " StateCode ", ScheduledStart as " ScheduledStart ", ScheduledEnd as " ScheduledEnd ", InstanceTypeCode as " InstanceTypeCode ", ActivityId as " ActivityId ", RegardingObjectIdYomiName as " RegardingObjectIdYomiName ", RegardingObjectTypeCode as " RegardingObjectTypeCode ", RegardingObjectIdName as " RegardingObjectIdName ", IsRegularActivity as " IsRegularActivity ", OwnerId as " OwnerId ", OwningBusinessUnit as " OwningBusinessUnit ", OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0".OwnerId in (SELECT id from dbo.fn_GetGuidsFromString (@buIds0)) UNION select Subject as "Subject", PriorityCode as " PriorityCode ", RegardingObjectId as " RegardingObjectId ", ActivityTypeCode as " ActivityTypeCode ", StateCode as " StateCode ", ScheduledStart as " ScheduledStart ", ScheduledEnd as " ScheduledEnd ", InstanceTypeCode as " InstanceTypeCode ", ActivityId as " ActivityId ", RegardingObjectIdYomiName as " RegardingObjectIdYomiName ", RegardingObjectTypeCode as " RegardingObjectTypeCode ", RegardingObjectIdName as " RegardingObjectIdName ", IsRegularActivity as " IsRegularActivity ", OwnerId as " OwnerId ", OwningBusinessUnit as " OwningBusinessUnit ", OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0".ActivityId in (select ObjectId from fn_POARetrieveMultiple (@SystemUserId0, @ObjectTypeCode0,@isHierarchicalSecurityModelEnabled0)) UNION select Subject as "Subject", PriorityCode as " PriorityCode ", RegardingObjectId as " RegardingObjectId ", ActivityTypeCode as " ActivityTypeCode ", StateCode as " StateCode ", ScheduledStart as " ScheduledStart ", ScheduledEnd as " ScheduledEnd ", InstanceTypeCode as " InstanceTypeCode ", ActivityId as " ActivityId ", RegardingObjectIdYomiName as " RegardingObjectIdYomiName ", RegardingObjectTypeCode as " RegardingObjectTypeCode ", RegardingObjectIdName as " RegardingObjectIdName ", IsRegularActivity as " IsRegularActivity ", OwnerId as " OwnerId ", OwningBusinessUnit as " OwningBusinessUnit ", OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0".OwningBusinessUnit in (@buId00) ) select top 51 "activitypointer0".Subject as "subject" , "activitypointer0".PriorityCode as " prioritycode " , "activitypointer0".RegardingObjectId as " regardingobjectid " , "activitypointer0".ActivityTypeCode as " activitytypecode " , "activitypointer0".StateCode as " statecode " , "activitypointer0".ScheduledStart as " scheduledstart " , "activitypointer0".ScheduledEnd as " scheduledend " , "activitypointer0".InstanceTypeCode as " instancetypecode " , "activitypointer0".ActivityId as " activityid " , "activitypointer0".RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0".RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0".RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid".InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH (NOLOCK) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH (NOLOCK) on ("activitypointer0".OwningUser = " activitypointerowningusersystemusersystemuserid ". SystemUserId ) where (("activitypointer0".IsRegularActivity = @IsRegularActivity0)) order by "activitypointer0".ScheduledEnd asc , "activitypointer0".ActivityId asc ' Query Above RetreiveMultipleSharingCountThreshold Value WITH "activitypointer0Security" as ( select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwnerId in ( SELECT id from dbo . fn_GetGuidsFromString ( @buIds0 )) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId00 and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) UNION select Subject as "Subject" , PriorityCode as " PriorityCode " , RegardingObjectId as " RegardingObjectId " , ActivityTypeCode as " ActivityTypeCode " , StateCode as " StateCode " , ScheduledStart as " ScheduledStart " , ScheduledEnd as " ScheduledEnd " , InstanceTypeCode as " InstanceTypeCode " , ActivityId as " ActivityId " , RegardingObjectIdYomiName as " RegardingObjectIdYomiName " , RegardingObjectTypeCode as " RegardingObjectTypeCode " , RegardingObjectIdName as " RegardingObjectIdName " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwningBusinessUnit in ( @buId00 ) ) select top 51 "activitypointer0" . Subject as "subject" , "activitypointer0" . PriorityCode as " prioritycode " , "activitypointer0" . RegardingObjectId as " regardingobjectid " , "activitypointer0" . ActivityTypeCode as " activitytypecode " , "activitypointer0" . StateCode as " statecode " , "activitypointer0" . ScheduledStart as " scheduledstart " , "activitypointer0" . ScheduledEnd as " scheduledend " , "activitypointer0" . InstanceTypeCode as " instancetypecode " , "activitypointer0" . ActivityId as " activityid " , "activitypointer0" . RegardingObjectIdYomiName as " regardingobjectidyominame " , "activitypointer0" . RegardingObjectTypeCode as " regardingobjecttypecode " , "activitypointer0" . RegardingObjectIdName as " regardingobjectidname " , "activitypointerowningusersystemusersystemuserid" . InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 )) order by "activitypointer0" . ScheduledEnd asc , "activitypointer0" . ActivityId asc SharingLimitForSnapshotTable Note This setting determines the threshold in which a Principal/ ObjectTypeCode entry should be created in the PrincipalObjectAccessReadSnapshot table. The default value for this setting is 10, and it can be modified via OrgDbOrgSettings . This value should be increased for customers that have users who are members of a large number of teams, and each team has a small amount of records shared. The setting increase would allow CRM to better handle this scenario, and better detect whether or not TVF should be used. Next post in this blog series: IdsCount* Settings .

Forum Post: RE: "Customize the system" shows "An error has occurred" message.

$
0
0
with CRM Online that error can't be fixed by yourself, so you need to open a support ticket to microsoft indicating the problem from your office365 portal

Forum Post: RE: Record cannot be deleted because of an association

$
0
0
check the relationships connected to the order entity and see which one has a cascade relationship, but my guess is that there is an invoice associated to that order, so you need to delete the invoice first.

Blog Post: IdsCount* Settings

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . These settings are what is used to determine how to format our security clause. There are three methods that can be used for the security clause based on these settings: Inline IDs, TVF, or Joins. Descriptions of the settings used to make this determination are below, along with query examples. In the query examples, the highlighted portion illustrates the differences made by each setting change. IdsCountForUsingGuidStringForSecurity This is the setting that determines whether we use Inline IDs, or pass the IDs as a string and parse the string using TVF to create an in-memory table of IDs. The default value for this setting is 20, and can be modified via OrgDbOrgSettings. This setting cannot be set to a higher value than IdsCountBeforeUsingJoinsForSecurity. IdsCountBeforeUsingJoinsForSecurity This is the setting that determines at what point we no longer use TVF as defined by the above setting, and instead use joins against the different security tables rather than passing IDs to SQL. The default value for this setting is 1000, and can be modified via OrgDbOrgSettings. This value cannot be set to a lower setting than IdsCountForUsingGuidStringForSecurity. Query Below IdsCountForUsingGuidStringForSecurity exec sp_executesql N'WITH "activitypointer0Security" as ( select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where ("activitypointer0". OwnerId in (@userPrincipalWithBasicDepth00,@userPrincipalWithBasicDepth1100,@userPrincipalWithBasicDepth2100,@userPrincipalWithBasicDepth3100,@userPrincipalWithBasicDepth4100,@userPrincipalWithBasicDepth537,@userPrincipalWithBasicDepth5360,etc.etc) or "activitypointer0".OwningBusinessUnit in (@buId00) ) UNION select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where ("activitypointer0".ActivityId in (select POA.ObjectId from PrincipalObjectAccess POA WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on POA.PrincipalId = sup.PrincipalId where sup.SystemUserId = @SystemUserId00 and POA.ObjectTypeCode = @ObjectTypeCode0 and ((POA.AccessRightsMask|POA.InheritedAccessRightsMask) & 1) = 1)) ) select top 51 "activitypointer0".Subject as "subject" , "activitypointer0".PriorityCode as "prioritycode" , "activitypointer0".RegardingObjectId as "regardingobjectid" , "activitypointer0".ActivityTypeCode as "activitytypecode" , "activitypointer0".StateCode as "statecode" , "activitypointer0".ScheduledStart as "scheduledstart" , "activitypointer0".ScheduledEnd as "scheduledend" , "activitypointer0".InstanceTypeCode as "instancetypecode" , "activitypointer0".ActivityId as "activityid" , "activitypointer0".RegardingObjectIdYomiName as "regardingobjectidyominame" , "activitypointer0".RegardingObjectTypeCode as "regardingobjecttypecode" , "activitypointer0".RegardingObjectIdName as "regardingobjectidname" , "activitypointerowningusersystemusersystemuserid".InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH (NOLOCK) left outer join SystemUser as "activitypointerowningusersystemusersystemuserid" WITH (NOLOCK) on ("activitypointer0".OwningUser = "activitypointerowningusersystemusersystemuserid".SystemUserId) where (("activitypointer0".IsRegularActivity = @IsRegularActivity0)) order by "activitypointer0".ScheduledEnd asc Query Above IdsCountForUsingGuidStringForSecurity, Below IdsCountBeforeUsingJoinsForSecurity exec sp_executesql N'WITH "activitypointer0Security" as ( select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0". OwnerId in (SELECT id from dbo.fn_GetGuidsFromString(@buIds0)) UNION select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0".ActivityId in (select POA.ObjectId from PrincipalObjectAccess POA WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on POA.PrincipalId = sup.PrincipalId where sup.SystemUserId = @SystemUserId00 and POA.ObjectTypeCode = @ObjectTypeCode0 and ((POA.AccessRightsMask|POA.InheritedAccessRightsMask) & 1) = 1) UNION select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0".OwningBusinessUnit in (@buId00) ) select top 51 "activitypointer0".Subject as "subject" , "activitypointer0".PriorityCode as "prioritycode" , "activitypointer0".RegardingObjectId as "regardingobjectid" , "activitypointer0".ActivityTypeCode as "activitytypecode" , "activitypointer0".StateCode as "statecode" , "activitypointer0".ScheduledStart as "scheduledstart" , "activitypointer0".ScheduledEnd as "scheduledend" , "activitypointer0".InstanceTypeCode as "instancetypecode" , "activitypointer0".ActivityId as "activityid" , "activitypointer0".RegardingObjectIdYomiName as "regardingobjectidyominame" , "activitypointer0".RegardingObjectTypeCode as "regardingobjecttypecode" , "activitypointer0".RegardingObjectIdName as "regardingobjectidname" , "activitypointerowningusersystemusersystemuserid".InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH (NOLOCK) left outer join SystemUser as "activitypointerowningusersystemusersystemuserid" WITH (NOLOCK) on ("activitypointer0".OwningUser = "activitypointerowningusersystemusersystemuserid".SystemUserId) where (("activitypointer0".IsRegularActivity = @IsRegularActivity0)) order by "activitypointer0".ScheduledEnd asc , "activitypointer0".ActivityId asc Query Above IdsCountForUsingJoinsForSecurity exec sp_executesql N'WITH "activitypointer0Security" as ( select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0". OwnerId in (select pem.PrincipalId from PrincipalEntityMap pem WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on pem.PrincipalId = sup.PrincipalId where sup.SystemUserId = @UserIdOwnerCommand00 and pem.ObjectTypeCode = @OtcOwnerCommand00) UNION select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0".ActivityId in (select POA.ObjectId from PrincipalObjectAccess POA WITH (NOLOCK) join SystemUserPrincipals sup WITH (NOLOCK) on POA.PrincipalId = sup.PrincipalId where sup.SystemUserId = @SystemUserId00 and POA.ObjectTypeCode = @ObjectTypeCode0 and ((POA.AccessRightsMask|POA.InheritedAccessRightsMask) & 1) = 1) UNION select Subject as "Subject", PriorityCode as "PriorityCode", RegardingObjectId as "RegardingObjectId", ActivityTypeCode as "ActivityTypeCode", StateCode as "StateCode", ScheduledStart as "ScheduledStart", ScheduledEnd as "ScheduledEnd", InstanceTypeCode as "InstanceTypeCode", ActivityId as "ActivityId", RegardingObjectIdYomiName as "RegardingObjectIdYomiName", RegardingObjectTypeCode as "RegardingObjectTypeCode", RegardingObjectIdName as "RegardingObjectIdName", IsRegularActivity as "IsRegularActivity", OwnerId as "OwnerId", OwningBusinessUnit as "OwningBusinessUnit", OwningUser as "OwningUser" from [ActivityPointer] as "activitypointer0" where "activitypointer0".OwningBusinessUnit in (@buId00) ) select top 51 "activitypointer0".Subject as "subject" , "activitypointer0".PriorityCode as "prioritycode" , "activitypointer0".RegardingObjectId as "regardingobjectid" , "activitypointer0".ActivityTypeCode as "activitytypecode" , "activitypointer0".StateCode as "statecode" , "activitypointer0".ScheduledStart as "scheduledstart" , "activitypointer0".ScheduledEnd as "scheduledend" , "activitypointer0".InstanceTypeCode as "instancetypecode" , "activitypointer0".ActivityId as "activityid" , "activitypointer0".RegardingObjectIdYomiName as "regardingobjectidyominame" , "activitypointer0".RegardingObjectTypeCode as "regardingobjecttypecode" , "activitypointer0".RegardingObjectIdName as "regardingobjectidname" , "activitypointerowningusersystemusersystemuserid".InternalEMailAddress as "activitypointerowningusersystemusersystemuserid.internalemailaddress" from activitypointer0Security as "activitypointer0" WITH (NOLOCK) left outer join SystemUser as "activitypointerowningusersystemusersystemuserid" WITH (NOLOCK) on ("activitypointer0".OwningUser = "activitypointerowningusersystemusersystemuserid".SystemUserId) where (("activitypointer0".IsRegularActivity = @IsRegularActivity0)) order by "activitypointer0".ScheduledEnd asc , "activitypointer0".ActivityId asc' , N'@IsRegularActivity0 bit,@UserIdOwnerCommand00 uniqueidentifier,@OtcOwnerCommand00 int,@SystemUserId00 uniqueidentifier,@ObjectTypeCode0 int,@buId00 uniqueidentifier' , @IsRegularActivity0 = 1 , @UserIdOwnerCommand00 = '10762A09-58F6-E311-B866-6C3BE5A80FD8' , @OtcOwnerCommand00 = 4200 , @SystemUserId00 = '10762A09-58F6-E311-B866-6C3BE5A80FD8' , @ObjectTypeCode0 = 4200 , @buId00 = '6E9336D9-BDCF-E311-B03A-78E7D162CED1' Next post in this blog series: Other Considerations .

Blog Post: Other Considerations

$
0
0
This post is part of a multi-part blog series regarding RetrieveMultiple performance. To see a list of the other parts of this series, click here . TotalRecordCount Considerations The TotalRecordCount query will also execute using the security considerations of RetrieveMultiple . Both the TotalRecordCount and RetrieveMultiple query need to complete prior to data being displayed for the end user. If the customer does not need the TotalRecordCount value to be displayed, it is recommended to disable it for performance reasons by setting SkipGettingRecordCountForPaging to True using OrgDbOrgSettings . An example of a TotalRecordCount query is below: WITH "activitypointer0Security" as ( select ActivityId as " ActivityId " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwnerId in ( SELECT id from dbo . fn_GetGuidsFromString ( @buIds0 )) UNION select ActivityId as " ActivityId " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . ActivityId in ( select POA . ObjectId from PrincipalObjectAccess POA WITH ( NOLOCK ) join SystemUserPrincipals sup WITH ( NOLOCK ) on POA . PrincipalId = sup . PrincipalId where sup . SystemUserId = @SystemUserId00 and POA . ObjectTypeCode = @ObjectTypeCode0 and (( POA . AccessRightsMask | POA . InheritedAccessRightsMask ) & 1 ) = 1 ) UNION select ActivityId as " ActivityId " , IsRegularActivity as " IsRegularActivity " , OwnerId as " OwnerId " , OwningBusinessUnit as " OwningBusinessUnit " , OwningUser as " OwningUser " from [ ActivityPointer ] as "activitypointer0" where "activitypointer0" . OwningBusinessUnit in ( @buId00 ) ) select COUNT (*) as [# TotalRecordCount ] from ( select top 5001 "activitypointer0" . ActivityId as " activityid " , " activitypointerowningusersystemusersystemuserid " . SystemUserId as " activitypointerowningusersystemusersystemuserid.systemuserid " from activitypointer0Security as "activitypointer0" WITH ( NOLOCK ) left outer join SystemUser as " activitypointerowningusersystemusersystemuserid " WITH ( NOLOCK ) on ( "activitypointer0" . OwningUser = " activitypointerowningusersystemusersystemuserid " . SystemUserId ) where (( "activitypointer0" . IsRegularActivity = @IsRegularActivity0 ))) as "# Subquery " Other Considerations and Limitations · When a query is being executed offline, we will default to ERMO = 3. Data is filtered when offline, so there isn’t a need for these optimizations. Also, security is not a big consideration when offline, since you cannot take any data offline that you don’t have access to read anyway. Additionally, the Shapshot tables are not taken offline. · Quick Find defaults to ERMO = 3. The reason for this is that the quick find will be the most selective criteria, thus there is no need to add the overhead of a CTE query. · RetrieveMultiple settings are universal, so currently they cannot be set differently per entity. This is being considered for a future release. This is the last part of this blog series.

Forum Post: Can a 3-hop referential lookup be done in CRM 2016 / Dynamics 365?

$
0
0
We've used filtered lookups for some time with good results but I'd like to take it a step further, if the technology allows. I think that this may require some JS (preFilterLookup?) but am not certain. Here is the scenario: We have 4 entities involved: Contacts - parented by.... Accounts - child relationship to.... Hot Sheets - child relationship to... Printers - which has an N:1 referential relationship to Contacts Today we can do a lookup from Printers to any Contact. Great - other than the fact that we get >5,000 names. What we would like to do is filter that list down to only the Contacts that exist only in the Account that is common to the Hot Sheet...which the Printer is parented by. Is this possible? Does this make sense? Any input would be appreciated. I'm thinking it's possible but at this point the best we've come up with is presenting only Contacts in Accounts that have a Hot Sheet. I haven't been able to figure out how to take that next step to filter down to the Printers that are parented by the Hot Sheets. Related Records filtering does not seem to be the solution since there is not a 1:N relationship from Contacts to Printers and we don't think we'd want that since we want to restrict a 1:1 user to printer limit. Thank you.

Forum Post: RE: Record cannot be deleted because of an association

$
0
0
Thank you! it was the Invoice. Once I deleted the invoice I was able to delete the order

Blog Post: Few more interesting issues in New Form Rendering in CRM 2016 Update 1

$
0
0
We recently upgraded to CRM 2016 Update 1 and there seems to be noend to the different product issues that we are facing. The latest ones are missing scroll bar in BPF when a particular stage has large number of fields in it and the other one being ...read more

Forum Post: RE: Composite Address Field Spacing Issues With Word Templates

$
0
0
Hi jperry! I have the exact same problem, did you figure out a solution you would like to share? Thank you! /Isabell

Forum Post: UI issue when using JavaScript onChange to show/hide section containing subgrid

$
0
0
I have a section on a custom entity's Information form that contains a couple fields and a sub-grid of contacts (labelled participants). When I use the below JavaScript to show/hide that section based on another field selection, under certain circumstances it consistently appears incorrectly. This only occurs when I have the record saved in a way where this section is hidden, and then I change the field that triggers it to display. If I then save the record and refresh it, it displays properly. It would seem that the onLoad JavaScript works fine, but when I call the same function as an onChange for the pll_service field it is appearing as shown in the image below. Any thoughts on this? Functionality doesn't seem to be impacted, it just looks wrong. JavaScript used: (called as an onLoad function and as an onChange function for the pll_service field which is an option set data type) function trainingIncluded(){ var trainingStatus = Xrm.Page.getAttribute("pll_service").getText(); if(trainingStatus != "Training") { Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(false); } else { Xrm.Page.ui.tabs.get("General_Tab").sections.get("Training").setVisible(true); } } Image of issue: (Note how the label of "Participants" as well as the buttons for adding records/viewing grid are shown within the column headers instead of above)

Forum Post: RE: Impacts of changing OOB Parental behavior

$
0
0
Thank you everyone the issue is resolved. I did find that only opportunities that are created AFTER the relationship was modified did act as expected so we had to do some data clean up per andrewbschultz.com/.../isolated-dynamics-crm-security-feature-reparent . I also modified the relationship to Cascade None on reparent only. Thanks for you help!
Viewing all 123975 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>