Posts

Showing posts with the label Reporting

Get Week Number in SQL Server

It happens frequently that certain clients want to see the weeknumber of certain dates in CRM reports. To accomplish this, you can use the following function in your query to get the week number for a given date: select datepart(ww,scheduledstart) from filteredappointment The above query will give you the weeknumber of the scheduled start date from the filtered appointments view. Kevin Dosseray

Get Current User in Reporting

If you want to use the current user id in custom reports for MS CRM 4.0 (for example to set a filter) , you can use the SQL function "organization name" _MSCRM.dbo. fn_finduserguid . This function will give you the guid of the current user which you can compare for example with the ownerid of a record. Kevin Dosseray